Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4.2 : undefined method `true' for #<User:...> with factory_girl #433

Closed
osaris opened this issue Oct 5, 2014 · 2 comments
Closed

Comments

@osaris
Copy link

osaris commented Oct 5, 2014

Hello,

I'm testing rails 4.2.0.beta2 on my project and it works well except that all my tests are red due to the following error :

method_missing': undefined method true' for #User:0x007f9568a5a578 (NoMethodError)``

with a basic factory :

FactoryGirl.define do
  factory :user do
    sequence(:email) { |n| "test#{n}@test.com"}
    station
    password('test1234')
    password_confirmation('test1234')
  end
end

This error come from authlogic because If I remove remove authlogic from my User model there isn't error anymore.

Any advice ?

@osaris
Copy link
Author

osaris commented Oct 5, 2014

It seems to come from

validates_numericality_of :login_count, :only_integer => true, :greater_than_or_equal_to => 0, :allow_nil => true if column_names.include?("login_count")
validates_numericality_of :failed_login_count, :only_integer => true, :greater_than_or_equal_to => 0, :allow_nil => true if column_names.include?("failed_login_count")

and the only_integer options seems to have been changed recently in rails (rails/rails@64a05a9). But I don't know why it treat true as a symbol (so send true to the record) :

https://github.com/rails/rails/blob/master/activemodel/lib/active_model/validations/numericality.rb#L81-L82

@osaris
Copy link
Author

osaris commented Oct 5, 2014

Ok my bad, fixed in master :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant