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
One thought on “Cucumber vs ActiveRecord 2.3 — Attempt to call private method (NoMethodError)”
Thanks for the helpful post Michael, I’ve just done a bit of digging and it looks as if this has since been fixed: