I have the following action to confirm a 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 the object doesn't exist I'm getting the following error
NameError in ConfirmsController#create
undefined local variable or method `errors' for #<ConfirmsController:0x007f921de173d0>
Why it doesn't recognize errors and how can I handle error for this case?