rails/rails — Issue #4397: ActiveRecord::ReadOnlyRecord error for object from belongs_to association
Author: bartekd
Created: 2012-01-10 12:06:17+00:00
State: open

I receive ActiveRecord::ReadOnlyRecord error for object from belongs_to association with callback `after_create`.
For instance as below object user is readonly - is it good behaviour?

```ruby
class CreditsUsage < ActiveRecord::Base
belongs_to :user
after_create :deduct_credits_from_user!

private
def deduct_credits_from_user!
user.decrement!(:credits_left, credits_count)
end

end
```