Unverified Commit 74e7c1c2 authored by azul's avatar azul
Browse files

TaskParticipation -> Task::Participation

cleans up circular dependency:
RuntimeError: Circular dependency detected while autoloading constant Task::TaskParticipation
parent 61cbf6b0
...@@ -2,8 +2,9 @@ class Task < ActiveRecord::Base ...@@ -2,8 +2,9 @@ class Task < ActiveRecord::Base
belongs_to :page belongs_to :page
# has_and_belongs_to_many :users, :foreign_key => 'task_id' # has_and_belongs_to_many :users, :foreign_key => 'task_id'
has_many :task_participations, dependent: :destroy has_many :participations,
has_many :users, through: :task_participations dependent: :destroy
has_many :users, through: :participations
acts_as_list scope: :page acts_as_list scope: :page
format_attribute :description format_attribute :description
validates_presence_of :name validates_presence_of :name
......
class TaskParticipation < ActiveRecord::Base class Task::Participation < ActiveRecord::Base
self.table_name = 'task_participations'
belongs_to :user belongs_to :user
belongs_to :task belongs_to :task
end end
...@@ -245,7 +245,9 @@ class User < ActiveRecord::Base ...@@ -245,7 +245,9 @@ class User < ActiveRecord::Base
## ASSOCIATED DATA ## ASSOCIATED DATA
## ##
has_many :task_participations, dependent: :destroy has_many :task_participations,
class_name: 'Task::Participation',
dependent: :destroy
has_many :tasks, through: :task_participations do has_many :tasks, through: :task_participations do
def pending def pending
......
...@@ -23,7 +23,7 @@ module Crabgrass ...@@ -23,7 +23,7 @@ module Crabgrass
config.autoload_paths << "#{Rails.root}/lib" config.autoload_paths << "#{Rails.root}/lib"
config.autoload_paths << "#{Rails.root}/app/models" config.autoload_paths << "#{Rails.root}/app/models"
config.autoload_paths += %w(chat profile poll task requests mailers notice). config.autoload_paths += %w(chat profile poll requests mailers notice).
collect { |dir| "#{Rails.root}/app/models/#{dir}" } collect { |dir| "#{Rails.root}/app/models/#{dir}" }
config.autoload_paths << "#{Rails.root}/app/permissions" config.autoload_paths << "#{Rails.root}/app/permissions"
config.autoload_paths << "#{Rails.root}/app/helpers/classes" config.autoload_paths << "#{Rails.root}/app/helpers/classes"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment