ruby on rails - ActiveRecord Create (not !) Throwing Exception on Validation -


So I'm using ActiveRecord model assumptions so that any form in a blank application is valid.

I have an action that does:

  @association = association.new  

and make the end of the form

  @association = user.associations.create (data)  

I want to: If the verification fails, just to create an action please present. The problem is that the .create (no!) Method is throwing an exception in cases where the model verification fails. Example:

is valid_data_of: URL ,: with = & gt; /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[ Yaaz ] {2,5} (([0- 9] {1,5})? \ /.*)? $) / Ix ,: message = & gt; "Your URL is not valid."

is created in the model:

  ActiveRecord :: recordAnonymous exception: Verification failed: URL does not appear to be valid for your URL.  

I thought.

Am I missing something here?

Ruby 1.8.7 Patchlevel 173 Android Daily 2.3.3

Read the documentation and carefully.

Check both the Callback (in your case verification). If the method of withdrawal is false, and if the exception is not true, while the method is lifted exception if the record is invalid


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -