views:

124

answers:

1

I have a "custom" validation method that I only want executed on create like:

validate :post_count, :on => :create

def post_count
     # validate stuff
end  

but it gets fired on update (in addition to on create).

Does the :on => :create symbol not work with "custom" validation methods?

THanks!

+5  A: 

As far as I know, there's no :on option. Use

validate_on_create :post_count

instead. And there's validate_on_update also. You can read about this methods here.

j.
That's odd, i was sure :on existed... hmmm
thomasfedb