I'm having a go at implementing default contexts for a project ( http://dev.rousette.org.uk/ticket/162 ) because I'd like if certain work projects had a default context "@work" vs other projects that should be "@home" or whatever is appropriate. I'm new to rails, so I'm not sure if I'm specifying the model associations correctly, so I was hoping someone could take a look at the following (which appear to work from mucking about in the console) and tell me if the way I specified is appropriate or if there's a better way.
I created a migration to add a "default_context_id" column to projects as follows: add_column :projects, :default_context_id, :integer then added this line to the Project model belongs_to :default_context, :dependent => :nullify, :class_name => "Context", :foreign_key => "default_context_id" The wording "belongs_to" strikes me as clunky for this type of association, but has_one association (which sounds better to me) reverses the direction of the association. thanks -James
_______________________________________________ Tracks-discuss mailing list [email protected] http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
