Ruby on Rails Monday, June 3, 2013

I cannot duplicate your error running your github example.  Here's what I see:

/Dagnan/rails_inverse_of 656 > rails --version
Rails 3.2.13
/Dagnan/rails_inverse_of 657 > ruby --version
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]
/Dagnan/rails_inverse_of 658 >  ruby -Itest test/unit/campaign_test.rb
Run options:

# Running tests:

[1/1] CampaignTest#test_create_a_campaign_with_recurrenceHere
Here
Finished tests in 0.195217s, 5.1225 tests/s, 0.0000 assertions/s.
1 tests, 0 assertions, 0 failures, 0 errors, 0 skips

ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]
/Dagnan/rails_inverse_of 659 >

On Monday, June 3, 2013 1:55:29 AM UTC-4, Michel Pigassou wrote:

Help?

On Friday, May 31, 2013 7:39:30 PM UTC+2, Michel Pigassou wrote:
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/65ef8fb8-2e4b-4068-999c-b68a8fc29d15%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment