This project is archived and is in readonly mode.

#6632 new
Brian Jensen

Extend AR#save with :callback => false

Reported by Brian Jensen | March 27th, 2011 @ 06:46 PM

Real world usecase:

User
- belongs_to project

Project
- has_many :users

class User < ActiveRecord::Base 
 before_create :update_project_user_action

 def update_project_user_action
   project.user_action_date = Date.today
   project.save :validate => false
 end
end

If I come back a month later or a fellow developer adds some callbacks on Project or validations then my call might fail. My callback does not care about the Project overall state, just the specific field.

It could also be argued that #update_attribute should also be given this property. Currently it skips validations but not callbacks.

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages