So i’m trying to override save_with_validation in activerecord
validations.rb and i’m running in to problems with alias_chain method.
def save_with_validation(perform_validation = true)
if perform_validation && valid? || !perform_validation
Whats happening is that my save_with_validation is called when i call
.save then because of the alias chain method its called the
save_with_validation in validation.rb as save_without_validation.
So I found dirty.rb is also alias_method_chain ing save so I tried this
think this would re-alias those methods and it did something where my
error is now different:
SystemStackError: stack level too deep
number?' from /Users/Kevin/Desktop/light/vendor/rails/activerecord/lib/active_record/dirty.rb:154:infield_changed?’
write_attribute_without_dirty' from /Users/Kevin/Desktop/light/vendor/rails/activerecord/lib/active_record/dirty.rb:139:inwrite_attribute’
bln=' from /Users/Kevin/Desktop/light/vendor/rails/activerecord/lib/active_record/base.rb:2740:insend’
attributes=' from /Users/Kevin/Desktop/light/vendor/rails/activerecord/lib/active_record/base.rb:2736:ineach’
attributes=' from /Users/Kevin/Desktop/light/vendor/rails/activerecord/lib/active_record/base.rb:2434:ininitialize’
new' from /Users/Kevin/Desktop/light/vendor/rails/activerecord/lib/active_record/base.rb:721:increate’
what i want to do is grab the data passed in from save like this
object.save(:test) I want to grab that :test my code works when I put it
right in the rails files but not in plugin as i have to override stuff.
can anyone help?