Skip to content

Instantly share code, notes, and snippets.

@tbuehlmann
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbuehlmann/9726941 to your computer and use it in GitHub Desktop.
Save tbuehlmann/9726941 to your computer and use it in GitHub Desktop.
# app/models/list.rb
class List < AR::Base
has_many :list_tasks
has_many :tasks, through: :list_tasks
end
# app/models/task.rb
class Task < AR::Base
has_many :list_tasks
has_many :lists, through: :list_tasks
end
# app/models/list_task.rb
class ListTask < AR::Base
belongs_to :list
belongs_to :task
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment