Commit 9b404dbe5d0a8cf64aef97cc05f24a77e6828280
1 parent
c9e6851d
Exists in
master
and in
20 other branches
rails4: disable autosave on person association
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/models/person.rb
| @@ -293,8 +293,7 @@ class Person < Profile | @@ -293,8 +293,7 @@ class Person < Profile | ||
| 293 | end | 293 | end |
| 294 | 294 | ||
| 295 | after_update do |person| | 295 | after_update do |person| |
| 296 | - # FIXME: causes infinite loop with rails4 | ||
| 297 | - #person.user.save! | 296 | + person.user.save! |
| 298 | end | 297 | end |
| 299 | 298 | ||
| 300 | def is_admin?(environment = nil) | 299 | def is_admin?(environment = nil) |
app/models/user.rb
| @@ -85,7 +85,8 @@ class User < ActiveRecord::Base | @@ -85,7 +85,8 @@ class User < ActiveRecord::Base | ||
| 85 | end | 85 | end |
| 86 | end | 86 | end |
| 87 | 87 | ||
| 88 | - has_one :person, :dependent => :destroy | 88 | + # set autosave to false as we do manually when needed and Person syncs with us |
| 89 | + has_one :person, dependent: :destroy, autosave: false | ||
| 89 | belongs_to :environment | 90 | belongs_to :environment |
| 90 | 91 | ||
| 91 | attr_protected :activated_at | 92 | attr_protected :activated_at |