Home > Net >  Passing resource from controller to view in rails/devise
Passing resource from controller to view in rails/devise

Time:08-17

Rails 4.2.6 Devise 4.1.1

I want to redirect to a specific page after user has successfully updated his data using devise. Here is the Controller:

protected
  def after_update_path_for(resource)
    @email = resource.email
    after_update_path
  end

Here is the view:

<h3><%= @email %></h3>

Nothing shows up, any sugeestion?

CodePudding user response:

you need to pass the data as parameter to another controller. because you are doing redirect not render. but probably you don't need that because since the user still have the session, you can show the data of the current user via current_user method. so

<h3><%= current_user.email %></h3>

should work for you

  • Related