Answer the question
In order to leave comments, you need to log in
How to see all properties from users table in current_user(devise)?
I use gem devise in my project. There is a users table. It has a lot of fields that devise doesn't see. For example, there is a user balance: the balance field in the table.
I'm trying to achieve a balance reading in this style: current_user.balance
Now I have to do this:
usr = User.find current_user.id
usr.balance
Answer the question
In order to leave comments, you need to log in
The device cannot see or not see the fields. And the current user simply returns the model to which the device is attached.
If current_user.balance gives an error - write what.
If your device is not on the user, but, say, what STI, then write the outputcurrent_user.class.to_s
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question