Your setup here doesn't make much sense. In the new action, you should not look for the user. Most likely, if your routing is used correctly, you wonโt even get parma [: id]. The same thing happens in the creation method, which (as the name implies) should create a new user record, and not look for it.
A new action should only create a new record (without saving), for example
def new @user = User.new ...
he should now use this custom object to render the input form in new.html.erb
After the user submits a new form, he ends the create action. Now you create a new user and actually save in the database:
def create @user = User.new(params[:user]) if @user.save
At this point, it is not particularly relevant to the development and authentication of users.
This is just a rough overview to show you the most common process (as you might find in any good RoR tutorial). Otherwise, your question is not entirely clear about what exactly you want to do and what it is related to devise and current_user. Most likely, you will have some controllers and actions that will allow the user to see his email, groups and other user data. In this case, these controllers will have to use current_user (after logging in). Many projects have additional functionality for admin interfaces that allow a specific user to view user lists and their data. In this case, you will use current_user to make sure that the user has administrator rights and other search and search functions to display the data of managed users.
source share