views:

15

answers:

1

Greetings,

I have a custom validation in my exemplary Movie model:

class Movie < ActiveRecord::Base
  validate :it, :on => :create

  private

  def it
    self.errors.add 'foo', 'bar'
  end
end

This works on movie creation but also on updating an existing movie. :on => :update will also work for both. Might that be a bug or am I missing something?

Best regards

Tobias

+2  A: 

i think you should use validate_on_create instead

like

validate_on_create :it
Salil