Answer the question
In order to leave comments, you need to log in
Why does not work - if current_user?
Hello. You need to hide the link to edit the profile on the user's pages and display it only for the current_user. I use gem Devise.
I'm trying to do it like this:
- if current_user?
= link_to "Settings", edit_user_registration_path
- else
undefined method `current_user?' for #<#<Class:0x007f5fee1940b0>:0x007f5fecea0800>
- if user_signed_in?
Answer the question
In order to leave comments, you need to log in
Copy-paste the error
And you get the first link to the stackoverflow
Where does the method come from current_user?
if you haven't defined it anywhere? Devise creates a method current_user
and you can use it in the same way if current_user
Is it really easier to post a question on a toaster these days than to remove one character in the code?)
PS than user_signed_in? did not arrange it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question