Displaying 1 result from an estimated 1 matches for "addlistidtotasks".
2012 Aug 08
1
Creating ToDo List App
...2.6
and running into some foreign key issues. Here''s what I did...
I generated scaffolds
list title:string & task description:text listname:string
Next, in order to link the listname for Tasks and the list titles in the
Lists I generated a migration file which looks like this
class AddListIdToTasks < ActiveRecord::Migration
def change
add_column :tasks, :list_id, :integer
end
end
I then added active record association has_many :tasks and for the Task
I used belongs_to :list (, :foreign_key => "list_id)" - even though I
think this last part was unnecessary).
Finally I...