app/forms/decidim/admin/attachment_form.rb in decidim-admin-0.22.0 vs app/forms/decidim/admin/attachment_form.rb in decidim-admin-0.23.0
- old
+ new
@@ -14,14 +14,17 @@
attribute :attachment_collection_id, Integer
mimic :attachment
validates :file, presence: true, unless: :persisted?
+ validates :file, passthru: { to: Decidim::Attachment }
validates :title, :description, translatable_presence: true
validates :attachment_collection, presence: true, if: ->(form) { form.attachment_collection_id.present? }
validates :attachment_collection_id, inclusion: { in: :attachment_collection_ids }, allow_blank: true
delegate :attached_to, to: :context, prefix: false
+
+ alias organization current_organization
def attachment_collections
@attachment_collections ||= attached_to.attachment_collections
end