after_create do |post|
post.user.nil?
end def create
post = current_user.posts.create(post_params)
redirect_to post
enddef create
post = current_user.posts << Post.create(post_params)
redirect_to post
enddef create
transaction do
post = Post.create(post_params)
post.user = current_user
post.save
end
redirect_to post
end