Topic: Quick Question Quick Answer
I have A Blog.
The blog has many posts.
The post has a blog_id.
Is this the best way to save the blog_id?
@post = Post.new(@params[:post])
@blog = Blog.find(params[:id])
flash[:notice] = "Post was successfuly created into our uber engine."
@post.update_attribute(:blog_id, @blog.id) #This is what you should be focused on!!!!
redirect_to :controller => 'blogs', :action => 'show', :id => @blog
render :action => 'new'
Last edited by ldenman (2006-12-11 18:21:31)