KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
validate :updatable? # First validation there is with_options :if => Proc.new { |object| object.errors.empty? } do |updatable| updatable.with_options :if => "self.current_step == basic" do |step| validates .... bla-bla bla So, before any validations are made, the updatable subroutine is called and it populates the errors[:base] array with appropriate errors, meaning that object is not updatable. And I wanted it to skip the rest of the validations if any errors are found in this subroutine, but abovementioned example is NOT working - it performs all the validations. But, if I change :if => "self.current_step == basic" to :if => "self.errors.empty? && self.current_step == basic" is works like a charm. What I'm doing wrong ? Examples show, that nested with_option should work. Can someone help me ? Thanks in advance.
Tags (comma-separated)
Save Edits
Cancel