Ruby on Rails Tuesday, January 4, 2011

Please quote when replying. This makes the discussion easier to follow,
and makes it harder to forget to reply to part of a message.

Specifically, I asked to see generated SQL queries so that I could see
what data was getting sent from Rail to the DB. You provided none,
except for a SELECT query that contained no data.

Daniel Garcia wrote in post #972309:

[...]
> => #<User id: 2, faculty_id: nil, department_id: nil, role_id: 1, name:
> "Daniel", surname: "Garcia", username: "vinagrito", study_group
> : nil, study_course: nil, card_code: nil, day_time: false, email:
> "mail@mail.com", hashed_password: "6305ee7016b263c0ec41a81439a378837a
> 318035", salt: "5c33e8fed10b87c9f4b7841f0faeb7b10424289a">
> irb(main):012:0> user = User.where(:id => 1)
> => []
> irb(main):013:0> user = User.where(:id => 2)
> => [#<User id: 2, faculty_id: nil, department_id: nil, role_id: 1, name:
> "Daniel", surname: "Garcia", username: "vinagrito", study_grou
> p: nil, study_course: nil, card_code: nil, day_time: false, email:
> "mail@mail.com", hashed_password: 6305.0, salt: "5c33e8fed10b87c9f4b
> 7841f0faeb7b10424289a">]
> irb(main):014:0> user.to_sql
> => "SELECT `users`.* FROM `users` WHERE (`users`.`id` = 2)"
> irb(main):015:0>
>
> And in my DB everything's OK.But of course,as soon as I make a query
> from my controller then is going to bring "trash" (check at the
> hashed_password column in the rails console after I query for the
> record!)

Seems like Rails thinks your hashed_password is numeric. What does this
table's entry in db/schema.rb look like?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

--
Posted via http://www.ruby-forum.com/.

--
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