Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/models/comfy/cms/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class Comfy::Cms::File < ActiveRecord::Base
# -- Callbacks ---------------------------------------------------------------
before_validation :assign_label, on: :create
before_create :assign_position
after_save :process_attachment
# active_storage attachment behavior changed in rails 6 - see PR#892 for details
before_save :process_attachment, if: proc { Rails::VERSION::MAJOR >= 6 }
Comment thread
JeremiahChurch marked this conversation as resolved.
Outdated
after_save :process_attachment, unless: proc { Rails::VERSION::MAJOR >= 6 }

# -- Validations -------------------------------------------------------------
validates :label, presence: true
Expand Down
5 changes: 3 additions & 2 deletions app/models/comfy/cms/fragment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class Comfy::Cms::Fragment < ActiveRecord::Base
attr_reader :files

# -- Callbacks ---------------------------------------------------------------
after_save :remove_attachments,
:add_attachments
# active_storage attachment behavior changed in rails 6 - see PR#892 for details
before_save :remove_attachments, :add_attachments, if: proc { Rails::VERSION::MAJOR >= 6 }
after_save :remove_attachments, :add_attachments, unless: proc { Rails::VERSION::MAJOR >= 6 }

# -- Relationships -----------------------------------------------------------
belongs_to :record, polymorphic: true, touch: true
Expand Down