1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

remove associations with events on filter deletion

This commit is contained in:
Sylvain 2016-06-29 17:26:32 +02:00
parent e13870555b
commit eb7ee6300e
4 changed files with 4 additions and 3 deletions

View File

@ -1,3 +1,3 @@
class AgeRange < ActiveRecord::Base class AgeRange < ActiveRecord::Base
has_many :events has_many :events, dependent: :nullify
end end

View File

@ -1,3 +1,3 @@
class Category < ActiveRecord::Base class Category < ActiveRecord::Base
has_and_belongs_to_many :events, join_table: :events_categories has_and_belongs_to_many :events, join_table: :events_categories, dependent: :destroy
end end

View File

@ -8,7 +8,7 @@ class Event < ActiveRecord::Base
has_and_belongs_to_many :categories, join_table: :events_categories has_and_belongs_to_many :categories, join_table: :events_categories
validates :categories, presence: true validates :categories, presence: true
has_many :reservations, as: :reservable, dependent: :destroy has_many :reservations, as: :reservable, dependent: :destroy
has_and_belongs_to_many :event_themes, join_table: :events_event_themes has_and_belongs_to_many :event_themes, join_table: :events_event_themes, dependent: :destroy
belongs_to :age_range belongs_to :age_range

View File

@ -1,2 +1,3 @@
class EventTheme < ActiveRecord::Base class EventTheme < ActiveRecord::Base
has_and_belongs_to_many :events, join_table: :events_event_themes, dependent: :destroy
end end