title: FactoryGirl + RSpec + Rails 3 Engine 'undefined method'
body: <p>I have been trying to use FactoryGirl while developing a Rails 3 mountable engine, and when the factory is called in the spec, it returns the following error:</p>
  
  <pre><code>NoMethodError: undefined method `foo_bar=' for #&lt;Foo::Baz:0x007fed6e3e2700&gt;
  </code></pre>
  
  <p><strong>Models</strong></p>
  
  <p>Foo::Bar</p>
  
  <pre><code>module Foo
    class Bar &lt; ActiveRecord::Base
      has_many :bazs
    end
  end
  </code></pre>
  
  <p>Foo::Baz</p>
  
  <pre><code>module Foo
    class Baz &lt; ActiveRecord::Base
      belongs_to :bar
    end
  end
  </code></pre>
  
  <p><strong>Factories</strong></p>
  
  <pre><code>FactoryGirl.define do
    factory :foo_bar, class: Foo::Bar do
      ...
    end
  
    factory :foo_baz, class: Foo::Baz do
      foo_bar
    end
  end
  </code></pre>
  
  <p>Looking at other topics <a href="https://stackoverflow.com/questions/4949319/factorygirl-rspec-rails-3-undefined-method-attribute">FactoryGirl + RSpec + Rails 3 'undefined method ='</a> and followed the answer and it still did not work.</p>
  
  <p>Any ideas on how to solve this?</p>