Skip to content

Instantly share code, notes, and snippets.

@kornypoet
Created June 25, 2012 17:18
Show Gist options
  • Save kornypoet/2989976 to your computer and use it in GitHub Desktop.
Save kornypoet/2989976 to your computer and use it in GitHub Desktop.
require 'gorillib/model'
class Joke
include Gorillib::Model
field :is_so_fat, String, :default => "When she sits around the house, she sits *AROUND* the house"
field :wears, String
end
# >> Joke.field_names
# => [:is_so_fat, :wears]
# >> yo_mama = Joke.receive
# => #<Joke>
# >> yo_mama.is_so_fat
# => "When she sits around the house, she sits *AROUND* the house"
# >> yo_mama.wears = "combat boots"
# => "combat boots"
# >> yo_mama.wears
# => "combat boots"
# >> yo_mama = Joke.receive(:is_so_fat => "She puts on her belt with a boomerang")
# => #<Joke is_so_fat="She puts on her belt with a boomerang">
# >> yo_mama.attributes
# => {:is_so_fat=>"She puts on her belt with a boomerang", :wears=>nil}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment