9f8d0d28ac
Upgraded to rails 2.2.2 and replaced complex foodsoft.rb-loader with simple initializers/load_app_config.rb. Multiple foodcoops option is temporarly deactivated.
15 lines
350 B
Ruby
15 lines
350 B
Ruby
class Assignment < ActiveRecord::Base
|
|
|
|
belongs_to :user
|
|
belongs_to :task
|
|
|
|
# after user is assigned mark task as assigned
|
|
def after_create
|
|
self.task.update_attribute(:assigned, true)
|
|
end
|
|
|
|
# update assigned-attribute
|
|
def after_destroy
|
|
self.task.update_attribute(:assigned, false) if self.task.assignments.empty?
|
|
end
|
|
end
|