Ruby on Rails: How to bypass Model validation 4

Posted by Randika on April 09, 2010

In my recent application I have these two models (User, BusinessAccount) with some data validation which works well with their respective controllers.

While keeping these models with their data validation as it is, I wanted to create another Controller (SignupController) which save both model data at once. But  I wanted to bypass the original model validation when saving the data from SignupController.

Here is what I did to achieve it with save_with_validation(perform_validation = false) , hope this will help someone else who looking for the same.

Do you think it's usefull? share it on
  • Twitter
  • Facebook
  • Google Bookmarks
  • Digg
  • del.icio.us
  • LinkedIn
  • StumbleUpon
  • Technorati
Trackbacks

Use this link to trackback from your own site.

  • Yes, this post really helped me a lot. Thanks for sharing by providing the code.
  • save(false) would work as well.
  • Thank you Sohan. I read your blog, interesting.
  • Drink Rails blog has linked to your post.
blog comments powered by Disqus