Extend AR#save with :callback => false #964

Closed
lighthouse-import opened this Issue May 16, 2011 · 2 comments

Comments

Projects
None yet
3 participants

Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6632
Created by Brian Jensen - 2011-03-27 17:46:33 UTC

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.

inglesp commented Sep 21, 2011

Why has this been closed?

Contributor

pokonski commented Sep 21, 2011

All issues imported from lighthouse were closed by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment