Guest User

Untitled

a guest
Mar 4th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. I have an action in UserController that I want to use layout for JournalController.
  2.  
  3. The issue I'm having is that neither my instance variables (@page_title) nor my flash variables are getting rendered.
  4.  
  5. ## UserController app/controllers/user
  6. def change_password
  7. render :layout => 'journals'
  8. @page_title = "Change Password"
  9. @user=session[:user]
  10. if request.post?
  11. @user.update_attributes(:password=>params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
  12. if @user.save
  13. flash[:message]="Password Changed Successfully"
  14. else
  15. flash[:error]="There was an error saving your password. Please try again."
  16. end
  17. end
  18. end
  19.  
  20. ## app/view/layouts/journal.rhtml
  21. <title><%= @page_title %></title>
  22. <!-- More Code here -->
  23. <div class="notice">
  24. <%= flash[:message] %>
  25. </div>
  26. <div class="error">
  27. <%= flash[:warning] %>
  28. </div>
  29. <div class="error">
  30. <%= flash[:error] %>
  31. </div>
  32. <!-- More Code here -->
  33. <div id="content" class="content_outer">
  34. <div class="content_inner">
  35. <%= yield %>
  36. </div>
  37. </div>
Add Comment
Please, Sign In to add comment