1
私は、イベントオブジェクトを介してレコードを取得するだけのようなevent.bidsここファクトリーガールの2つの方法でレコードを取得する方法はありますか?
class Event < ActiveRecord::Base
has_many :bids , dependent: :restrict_with_error
end
class Bid < ActiveRecord::Base
belongs_to :event
end
factory :event do
after(:build) do |event|
create(:bid, event: event)
end
end
end
factory :bid do |f|
f.association(:event)
end
私はこのエラーを取得する
rspec spec/models/event_spec.rb
ターミナル
でコマンドを実行する方法ことはできませんよ/home/aqib/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:222:stac
私は 'f.associationだと思う(:イベント)'再帰を引き起こしています。 – 31piy
私はf.association(:イベント)にコメントしますが、それと同じ問題 –