Say for example I have two models, posts and category. Now say I want to make it so the from the category show page you can create a new post using the form_for method. To do this, you will obviously need access to the @category variable and a new instance of a post (@post). Is this acceptable code in the controller?
#app/controllers/categories_controller.rb
def show
@category = Category.find(params[:id])
@post = Post.new
end
Or is it bad practice to have two instance variables defined in the one controller action - and if it is, what would be the best practice for a case like this?
PostandCategoryrelated? Could you show that as well?