Rails errors doesn't work on controllers? how to handle error then? -


i have following action confirm pin code.

def create   @confirm = user.where(:email => params[:user][:email]).last   errors[:base] << "subscription not found" if @confirm.nil?   respond_with(@confirm) end 

if object doesn't exist i'm getting following error

nameerror in confirmscontroller#create  undefined local variable or method `errors' #<confirmscontroller:0x007f921de173d0> 

why doesn't recognize errors , how can handle error case?

errors using them typically on activerecord model. if want display error message try using flash method.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -