All of the sudden some columns began to misbehave in cucumber tests, claiming that “Attempt to call private method (NoMethodError)” on normal column attributes!
A simple fix for this, essentially saying that a method is not private when its a column:
#features/support/ar_private_fix.rb required from env.rb unless ActiveRecord::Base.methods.include?('private_method_defined_with_fix?') class ActiveRecord::Base class << self def private_method_defined_with_fix?(method) return false if columns_hash.keys.include?(method.to_s) private_method_defined_without_fix?(method) end alias_method_chain :private_method_defined?, :fix end end end
Thanks for the helpful post Michael, I’ve just done a bit of digging and it looks as if this has since been fixed:
http://github.com/rails/rails/commit/d60d7edce462f4602bfc9996689087a235b034c9
and
https://rails.lighthouseapp.com/projects/8994/tickets/2808-ar-attribute-collides-with-private-method-results-in-nomethoderror
Thanks again,
Eliot