Home selecting username using current_user in devise
Reply: 0

selecting username using current_user in devise

user590
1#
user590 Published in April 22, 2018, 12:30 am

I read that the helper current_user can be called in the view. So I have something like this

<h1> Customer id <%= User.select(:username).find(current_user).id %> </h1>

The equivalent of what I am trying to do in SQL is the following

SELECT username FROM users WHERE id = current_user

I am not sure what I am doing wrong. I'm getting this error message:

undefined local variable or method `current_user' for ApplicationController:Class

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.243659 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO