Guest User

Untitled

a guest
Jul 17th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. ## Controllers new method
  2. # GET /posts/new
  3. # GET /posts/new.xml
  4. def new
  5. @post = Post.new
  6. @user = User.new
  7. respond_to do |format|
  8. format.html # new.html.erb
  9. format.xml { render :xml => @post }
  10. end
  11. end
  12.  
  13. ## View 1 for new post this formats wrong
  14. <div class="page_wrapper">
  15. <%=link_to image_tag("/images/ridepool-logo.gif"), posts_path, :class => "logo"%>
  16.  
  17. <div id="search_box">
  18. <h1>Editing user</h1>
  19. some stuff here
  20. shouldn't this work?
  21. <% form_for(@post) do |f| %>
  22. <%= f.error_messages %>
  23. <p>
  24. <%= f.submit 'Create' %>
  25. </p>
  26. <% end %>
  27. </div>
  28. </div>
  29.  
  30. ## View 2 for new post(passing it the @user instead of @post) and it formats correctly
  31. <div class="page_wrapper">
  32. <%=link_to image_tag("/images/ridepool-logo.gif"), posts_path, :class => "logo"%>
  33.  
  34. <div id="search_box">
  35. <h1>Editing user</h1>
  36. some stuff here
  37. shouldn't this work?
  38. <% form_for(@user) do |f| %>
  39. <%= f.error_messages %>
  40. <p>
  41. <%= f.submit 'Create' %>
  42. </p>
  43. <% end %>
  44. </div>
  45. </div>
Add Comment
Please, Sign In to add comment