I have a problem with the rails 'validates_uniqueness_of' function and the state_machine gem. Please look at the code below:
state_machine :initial => :foo do
state :bar do
event :action do
transition :foo => :bar
As you can see, I want to validate the uniqueness of 'something' when the model is in the state of 'bar'. However, the validations seems to take already place during the transition. Therefor, my instance becomes invalid and the transition never finishes.
So, is there a way to make sure the validation takes place AFTER the transition had happened? Thank you.
Sorry for who is having a similar problem, but we solved the issue otherwise, by making the customer change their use case ;-) .