Last active
August 29, 2015 14:25
-
-
Save quolpr/9c376fb2dd02864640a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass | |
def initialize(&block) | |
instance_eval(&block) | |
end | |
def say(message) | |
@message = message | |
self | |
end | |
def to(user) | |
puts "Hey #{user}, I have a message for you: #{@message}" | |
end | |
end | |
MyClass.new { say('Hello').to('Ryan') } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#bin/rails g model Person name:string age:integer hair_color:integer | |
class Person < ActiveRecord::Base | |
validates_presence_of :name | |
validates :age, numericality: { greater_than: 0 } | |
enum hair_color: [ :brown, :blond, :black] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment