title: Overriding Rails engine model using concerns, getting uninitialized constant Concerns::Models
body: <p>I'm following Rails guide to <a href="http://guides.rubyonrails.org/engines.html#overriding-models-and-controllers" rel="nofollow">override engine models</a>, I'm using an <code>ActiveSupport::Concern</code> to override it.</p>
  
  <p>I've created a module inside the engine in <code>seven_gallery/lib/concerns/models/gallery.rb</code> that contains the following code:</p>
  
  <pre><code>module SevenGallery::Concerns::Models::Gallery
      extend ActiveSupport::Concern
  
      included do
          has_many :photos, dependent: :destroy
          default_scope { order("created_at desc") }
      end
  end
  </code></pre>
  
  <p>And changed <code>seven_gallery/app/models/seven_gallery/gallery.rb</code> code to:</p>
  
  <pre><code>module SevenGallery
    class Gallery &lt; ActiveRecord::Base
      include SevenGallery::Concerns::Models::Gallery
    end
  end
  </code></pre>
  
  <p>Now inside my host application where I've included my engine in <code>Gemfile</code> by </p>
  
  <pre><code>gem "seven_gallery", path: "../seven_gallery"
  </code></pre>
  
  <p>I have a <code>User</code> model that contains:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_one :gallery, class_name: SevenGallery::Gallery
  end
  </code></pre>
  
  <p>But whenever I run the application I get this error on the only line inside the <code>User</code> model:</p>
  
  <pre><code>uninitialized constant Concerns::Models
  </code></pre>