1
  validates :password, :presence => { :on => :create },
            :length => { :within => 4..40 }

and

  validates :password, :presence => { :on => :create },
            :length => { :within => 4..40, :on => :save }

I thought the default for a validation was :on => :save which means on both :create and :update? But when I replace the first with the second specs start failing expected valid? to return false, got true.

What's happening?

Meltemi
  • 37,979
  • 50
  • 195
  • 293

1 Answers1

0

As you say, :on => :save is the default and means on both update and create, so it's not needed. Perhaps you found a bug, but if i read your question, since we can't see your specs, your specs are passing without the :on => :save. Leave it out and carry on.

pjammer
  • 9,489
  • 5
  • 46
  • 56