Hello, i have just submitted a bug report, but maybe anybody has some
experience with this problem?
Here are the steps to reproduce the error:
Create an application with 2 models:
$ rails new assoc_test_app
$ cd assoc_test_app
$ rails generate model Person name:string
$ rails generate model Member person_id:integer
$ rake db:migrate
Set up an association:
class Member < ActiveRecord::Base
belongs_to :person, :inverse_of => :member
accepts_nested_attributes_for :person
end
class Person < ActiveRecord::Base
has_one :member
end
Now, in concole (rails c) do:
m = Member.new
m.build_person(:name => ‘John2’)
m.person.save
This produces “SystemStackError: stack level too deep”.
Without :inverse_of it works fine.
Is there a reason not to use :inverse_of with
accepts_nested_attributes_for, or is it just a bug?
Thanks.
Alexey.