I have a location
model and a post
model. I want to allow the user to create new posts
from the index
page of the l
Try something like this
LocationController
def index
@location = Location.find(:all)
@post = Post.new
end
Now ur location view would have access to the instance variable @post
. Render a partial using that
render :partial => 'posts/post', :object => @post
Just create a @post
variable in your action in the LocationsController.
You can start the form like this:
<%= form_for Post.new do ... %>