Ruby on Rails Monday, August 29, 2011

Hey, I have the following line in my controller:

User.create(:email => "fuuu@bar.com", :password =>
'asldfkjadsfadsf', :ip => request.remote_ip)

my IP is 127.0.0.1 - now User.find_by_ip('127.0.0.1') returns 0
records although User.first contains '127.0.0.1'

if I change it to:

User.create(:email => "fuuu@bar.com", :password =>
'asldfkjadsfadsf', :ip => '127.0.0.1')
the finder returns the record

The model is a devise model, ip is attr_accessible
Can anyone please help me getting out of this confusion? I don't
understand it

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment