Closed jaischeema closed 12 years ago
Can you show an example where it doesn't work?
In this model, https://github.com/jaischeema/doorkeeper/blob/datamapper/app/models/application.rb, in place of before:valid?
, I was using before :create
.
I also removed the generate methods from within the block and tried to use a simple put "in the hook
, but it doesn't do anything.
before :create/:save hook won't be called if a resource is not valid, this is why in this case you need to do before :valid? and it's ok
oh, I didnt knew that was the expected behaviour and was going by ActiveRecord sort of workflow. Thank you for your time.
I am using dm-rails version 1.2.0 with dm-core version 1.2.0 and rails version 3.1.3.
In my model, when I define
before :valid?
orbefore :destroy
, they work without any problem butbefore :save
orbefore :create
does not work.Please let me know what else do I need to submit to this issue.