-
-
Save ratnikov/270696 to your computer and use it in GitHub Desktop.
This file contains 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
## 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