Should look like this class Schedule 'Task', :foreign_key => 'active_task_id' end class Task 'Schedule', :foreign_key => 'active_task_id' end the conceptually tricky part is defining the 'relevant_schedule' relation. This isn't really needed in most cases (i.e. Will not be used by code you write), is needed for compelteness of the ORM it's unlikely you'll ever want to use task.
Relevant_schedule (in many cases it would be nil), you'll probably mostly want to use schedule. Active_task in your code relevant_schedule' is just an arbitrary name, you may choose any other name you like. :class_name and :foreign_key must exactly match database and model names.
Perhaps the 'relevant_schedule' definition may be omitted altogether. I'm not sure.
Should look like this class Schedule 'Task', :foreign_key => 'active_task_id' end class Task 'Schedule', :foreign_key => 'active_task_id' end the conceptually tricky part is defining the 'relevant_schedule' relation. This isn't really needed in most cases (i.e. Will not be used by code you write), is needed for compelteness of the ORM.It's unlikely you'll ever want to use task.
Relevant_schedule (in many cases it would be nil), you'll probably mostly want to use schedule. Active_task in your code.'relevant_schedule' is just an arbitrary name, you may choose any other name you like. :class_name and :foreign_key must exactly match database and model names.
Perhaps the 'relevant_schedule' definition may be omitted altogether. I'm not sure.
This is great. Thanks for your help – Dative Aug 30 '10 at 10:36.
It seems like you'd be better off using an attribute rather than creating a separate id. Maybe your task could have a boolean column called active, then the active task for a schedule could be found with: @schedule.tasks. Select {|t|t.
Active? } Or your could create named scope to accomplish the same thing.
This was my plan-b. Looks like I should read up on named scopes too. Thanks.
– Dative Aug 30 '10 at 10:25.
And many-to-many relationships between models. Association to describe its role in the relation. The foreign key.
There are two ways to build a many-to-many relationship. Use has_many :through. When you never work directly with the relationship itself.
Is it a belongs_to or has_one association? Both express a 1-1 relationship. Involving the saving of associated objects.
To false will never save the members. About :autosave option is available at autosave_association. Assignment is cancelled.
Its foreign key.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.