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
Post a Comment