Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Controllers new method
- # GET /posts/new
- # GET /posts/new.xml
- def new
- @post = Post.new
- @user = User.new
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @post }
- end
- end
- ## View 1 for new post this formats wrong
- <div class="page_wrapper">
- <%=link_to image_tag("/images/ridepool-logo.gif"), posts_path, :class => "logo"%>
- <div id="search_box">
- <h1>Editing user</h1>
- some stuff here
- shouldn't this work?
- <% form_for(@post) do |f| %>
- <%= f.error_messages %>
- <p>
- <%= f.submit 'Create' %>
- </p>
- <% end %>
- </div>
- </div>
- ## View 2 for new post(passing it the @user instead of @post) and it formats correctly
- <div class="page_wrapper">
- <%=link_to image_tag("/images/ridepool-logo.gif"), posts_path, :class => "logo"%>
- <div id="search_box">
- <h1>Editing user</h1>
- some stuff here
- shouldn't this work?
- <% form_for(@user) do |f| %>
- <%= f.error_messages %>
- <p>
- <%= f.submit 'Create' %>
- </p>
- <% end %>
- </div>
- </div>
Add Comment
Please, Sign In to add comment