Ruby on Rails Friday, May 31, 2013

Hi.


I created an app to illustrate my problem: https://github.com/Dagnan/rails_inverse_of

I have a model with a belongs_to, and the other with a has_one. So far so good.
When I configure the option inverse_of on both model and I perform a simple #save on the main object, it is actually saved two times (once saved and then updated).

Is it an expected behavior?

A way to avoid this problem would be not to use inverse_of, or to have "autovalidate: false" in the second model (Recurrence in my example) for the has_one association.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fd418f1a-3c1d-48ec-9f1c-daad47331001%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment