title: How can I make routes from a Rails 3 engine available to the host application?
body: <p>I have a Rails 3 application with several engines containing additional functionality. Each engine is a separate service that customers can purchase access to.</p>
  
  <p>I am, however, having a problem with routes from the engines that aren't readily available to the controllers and views.</p>
  
  <p>controller:</p>
  
  <pre><code>class ClassroomsController &lt; ApplicationController
    ..
    respond_to :html
  
    def index
      respond_with(@classrooms = @company.classrooms.all)
    end
  
    def new
       respond_with(@classroom = @company.classrooms.build)
    end
  
    ..
  end
  </code></pre>
  
  <p><code>app/views/classrooms/new.html.haml</code>:</p>
  
  <pre><code>= form_for @classroom do |f|
    ..
    f.submit
  </code></pre>
  
  <p><code>config/routes.rb</code> in engine:</p>
  
  <pre><code>MyEngineName::Engine.routes.draw do
    resources :classrooms
  end
  </code></pre>
  
  <p><code>config/routes.rb</code> in app:</p>
  
  <pre><code>Seabed::Application.routes.draw do
    mount MyEngineName::Engine =&gt; '/engine'
    ...
  end
  </code></pre>
  
  <p><code>lib/my_engine_name.rb</code> in engine:</p>
  
  <pre><code>module MyEngineName
    class Engine &lt; ::Rails::Engine
    end
  end
  </code></pre>
  
  <p>attempting to go to <code>/classrooms/new</code> results in </p>
  
  <pre><code>NoMethodError in Classrooms#new
  
  Showing app/views/classrooms/_form.html.haml where line #1 raised:
    undefined method `hash_for_classrooms_path' for #&lt;Module:0x00000104cff0f8&gt;
  </code></pre>
  
  <p>and attempting to call <code>classrooms_path</code> from any other view results in the same error.
  I can, however, call <code>MyEngineName::Engine.routes.url_helpers.classrooms_path</code> and get it working. I'm thinking I might have defined the routes wrong, but can't find another way that works.</p>
  
  <p>Tried running the app with both Passenger (standalone and Apache module) and WEBrick (rails server). Using latest Rails from Git (<code>7c920631ec3b314cfaa3a60d265de40cba3e8135</code>).</p>