Here you have `@post = current_user.posts.new` and above you have `@post = Post.new`.  I suggest you bring these into a before_action or a helper like:

# in PostsHelper
def new_post
  @new_post ||= Post.new
end

Then in your modal form use that method which instantiates a post as needed.