am querying from my User table using the user name, how do i get the user id from the query object User.where(user_name: "john")
my goal is to get the User id: 5, i thought it was as easy as (.id), but thats not working
=> #<ActiveRecord::Relation [#<User id: 5, user_name: "john", user_city: "India", created_at: "2019-01-19 18:02:32", updated_at: "2019-01-19 18:02:32">]>
Aucun commentaire:
Enregistrer un commentaire