dimanche 10 janvier 2016

I have confusion about before_save call back in between rails 2.3.5 and rails 3.2.21

Currently i am upgrading the environment from rails 2.3.5 to rails 3.2.21.

I have create the schema and run the command for executing the migration -

bundle exec rake TK_EMAIL=test@example.com TK_USERNAME=admin TK_PASSWORD=test123 db:migrate

one of my migration has following code

negative = Test.new
negative.result = 'negative'
negative.response = 'negatibve'
negative.colour = '#e11d2b'
negative.sequence = 1
negative.is_completion = true
negative.positive_completion = false
negative.save!

And In model i have

 before_save :sanitize

   def sanitize
     # some code
   end

when migration is run before_save called in rails 3.2.21 but Not in rails 2.3.5 What is the issue here?

Aucun commentaire:

Enregistrer un commentaire