Hello
I'm trying to branch based on the return value of first_or_create, but
something eludes me.
flight = Flight.first_or_create({:avatar_id => avatar.id, :mission_id =>
mission.id} , {:monture_id => monture.id, :role_id => role.id, :temps_vol
=> params[:temps_vol], :statutfinmission_id => statut.id})
When the user submits a new Flight entry, I first check if an entry already
exists (using the table's composite key avatar.id + mission.id).
But as I understand it, flight will always return true, whether it creates
a new record or finds one already existing. Is this correct? Is there
anyway to differentiate between the two cases?
Thx a bunch.
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/datamapper/-/uhx12rVuVrwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.