I need to skip the validation on create method.I am using Rails 4 and ruby 2
i have tried like this
@model.save(:validate => false)
it not working
Assuming you are talking about ActiveRecord; In Rails 3 and 4 the way to skip validations and potentially persist invalid objects is as you describe:
@model.save(:validate => false)
In Rails 2 you'd need to do
@model.save(false)
.create!() or .create()? (would just be a little more elegant in some use cases)You can do this in model by
validates :some_attr, :presence => true, :on => :update
@model.save(:validate => false)not working? What version of Rails are you using?