-
Notifications
You must be signed in to change notification settings - Fork 0
castlerock/act_as_todo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
To create the table for todo table structure We have to run rake acts_as_todo:create to rollback rake acts_as_todo:roll_back To create the relation between models and Todo class class Lesson < ActiveRecord::Base aatd end class User < ActiveRecord::Base work_to_do end This will show how the relation works ruby-1.8.7-p334 :001 > User.create(:name => 'tripurari') => #<User id: 1, name: "tripurari", created_at: "2011-06-03 04:49:31", updated_at: "2011-06-03 04:49:31"> ruby-1.8.7-p334 :002 > Lesson.create(:name => "should be done") => #<Lesson id: 1, name: "should be done", created_at: "2011-06-03 04:50:04", updated_at: "2011-06-03 04:50:04"> ruby-1.8.7-p334 :003 > Lesson.create(:name => "Should be done later") => #<Lesson id: 2, name: "Should be done later", created_at: "2011-06-03 04:50:23", updated_at: "2011-06-03 04:50:23"> ruby-1.8.7-p334 :004 > User.first.todos.create(:work => Lesson.first) => #<Todo id: 1, worker_id: 1, worker_type: "User", work_id: 1, work_type: "Lesson", started_at: nil, end_at: nil, created_at: "2011-06-03 04:50:32", updated_at: "2011-06-03 04:50:32"> ruby-1.8.7-p334 :005 > Lesson.last.todos.create(:worker => User.first) => #<Todo id: 2, worker_id: 1, worker_type: "User", work_id: 2, work_type: "Lesson", started_at: nil, end_at: nil, created_at: "2011-06-03 04:50:39", updated_at: "2011-06-03 04:50:39"> ruby-1.8.7-p334 :006 > Todo.first.work => #<Lesson id: 1, name: "should be done", created_at: "2011-06-03 04:50:04", updated_at: "2011-06-03 04:50:04"> ruby-1.8.7-p334 :007 > Todo.first.worker => #<User id: 1, name: "tripurari", created_at: "2011-06-03 04:49:31", updated_at: "2011-06-03 04:49:31">
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published