app/models/archangel/collection.rb in archangel-0.3.0 vs app/models/archangel/collection.rb in archangel-0.4.0
- old
+ new
@@ -12,19 +12,16 @@
after_destroy :column_reset
validates :name, presence: true
validates :slug, presence: true, uniqueness: { scope: :site_id }
- has_many :entries, inverse_of: :collection
- has_many :fields, inverse_of: :collection
+ belongs_to :site
+ has_many :entries, dependent: :destroy
+ has_many :fields, dependent: :destroy
+
accepts_nested_attributes_for :fields, reject_if: :all_blank,
allow_destroy: true
-
- belongs_to :site
-
- has_many :entries
- has_many :fields
##
# Overwrite resource id to `slug`
#
# @return [String] the aliased resource param