added validations to post.rb