@category = Category.find(params[:category_id])
@blog = Blog.find(params[:blog_id])
@post = @blog.posts.build(post_params.merge(category_id: @category.id))
@post.save
@blog = Blog.find(params[:blog_id])
@blog = @blog.posts.build(post_params.merge(user_id: current_user.id)
@blog.save
</code