def create
msg = current_user.msgs.build(params[:msg])
msg.message = msg.message
msg.created_at = Time.now # HACK
if msg.save
else
flash[:error] = "Your article must contain some text."
end
redirect_to root_path
end
This is my controller code to save a message, it worked before I tried rails g migration add_anonymous_to_msg anonymous:boolean and rake db:migrate Now I get the error “your article must contain some text” which means the messages are no longer being saved or the text is not being recognised. I tried removing the column and my schema.rb says that it no longer exists but the error still persists.
Does anyone know what might be the problem? Thanks
How about:
Removes the need for the empty if block.