Skip to content

Instantly share code, notes, and snippets.

@ratnikov
Forked from anonymous/gist:270690
Created January 6, 2010 21:36
Show Gist options
  • Save ratnikov/270696 to your computer and use it in GitHub Desktop.
Save ratnikov/270696 to your computer and use it in GitHub Desktop.
## I seem to have lost my base models - I had obtained them already from pre-existing tables.
Basically, this relates to one table, a model and a subclass, which I thought would be quite short.
class Person < ActiveRecord::Base
has_one :address
has_one :phone
belongs_to :district
def member?
mem # and if you really require true/false: !!mem
end
end
create_table "people", :force => true do |t|
t.integer "roll"
t.integer "district_id"
t.text "title"
t.text "forenames"
t.text "surname"
t.boolean "mem"
t.datetime "created_at"
t.datetime "updated_at"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment