Skip to content

Commit

Permalink
Merge pull request #152 from ludwigschubert/master
Browse files Browse the repository at this point in the history
Only swap changed attributes which are persistable, i.e. are DB columns.
  • Loading branch information
swanandp committed Jul 6, 2015
2 parents 5e3ceda + 20d9d0d commit bd87a59
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/acts_as_list/active_record/acts/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,11 @@ def update_positions

# Temporarily swap changes attributes with current attributes
def swap_changed_attributes
@changed_attributes.each { |k, _| @changed_attributes[k], self[k] =
self[k], @changed_attributes[k] }
@changed_attributes.each do |k, _|
if self.class.column_names.include? k
@changed_attributes[k], self[k] = self[k], @changed_attributes[k]
end
end
end

def check_scope
Expand Down

0 comments on commit bd87a59

Please sign in to comment.