Skip to content

Commit

Permalink
fixed deprecation warning with Rails 4 (Relation#update_all with cond…
Browse files Browse the repository at this point in the history
…itions is deprecated)
  • Loading branch information
alto committed May 29, 2013
1 parent 608d233 commit 9d655e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* fixed deprecation warning with Rails 4 (Relation#update_all with conditions is deprecated)
* fixing issue #69 (ActiveRecord scopes are not chainable)

## 3.0.18
Expand Down
2 changes: 1 addition & 1 deletion lib/aasm/persistence/active_record_persistence.rb
Expand Up @@ -82,7 +82,7 @@ def aasm_write_state(state)
write_attribute(self.class.aasm_column, state.to_s)

success = if AASM::StateMachine[self.class].config.skip_validation_on_save
self.class.update_all({ self.class.aasm_column => state.to_s }, self.class.primary_key => self.id) == 1
self.class.where(self.class.primary_key => self.id).update_all(self.class.aasm_column => state.to_s) == 1
else
self.save
end
Expand Down

0 comments on commit 9d655e8

Please sign in to comment.