Skip to content

Commit

Permalink
Rails 5.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fragoulis committed Dec 10, 2018
1 parent 568d87b commit 932d6d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/carrierwave/mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def #{column}_identifier
end
def store_previous_changes_for_#{column}
ch = changes.symbolize_keys
ch = ::ActiveRecord.version.to_s.to_f >= 5.1 ? saved_changes : changes
ch = ch.symbolize_keys
@_previous_changes_for_#{column} = ch[_mounter(:#{column}).serialization_column]
end
Expand Down Expand Up @@ -333,7 +334,8 @@ def #{column}_identifiers
end
def store_previous_changes_for_#{column}
ch = changes.symbolize_keys
ch = ::ActiveRecord.version.to_s.to_f >= 5.1 ? saved_changes : changes
ch = ch.symbolize_keys
@_previous_changes_for_#{column} = ch[_mounter(:#{column}).serialization_column]
end
Expand Down
1 change: 1 addition & 0 deletions lib/carrierwave/mounter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def serialization_column
end

def remove_previous(before=nil, after=nil)
after ||= []
return unless before

# both 'before' and 'after' can be string when 'mount_on' option is set
Expand Down

0 comments on commit 932d6d2

Please # to comment.