Search code examples
ruby-on-rails-3rubygemsruby-on-rails-plugins

Mounting Rails 3 Engines


I created a Rails 3 engine that is namespaced. Within my engine, I have views, but they are in the app/views/engine_name folder.

When I mounted this engine into my project, I added gem 'engine_name', path: '../engine_name' to my Gemfile.

Now, when I go to mysite.local.com:3000/engine_name/controller, I get an error that it can't find the view. It's looking in "/Users/shamoon/Sites/engine_name/app/views" instead of "/Users/shamoon/Sites/engine_name/app/engine_name/views"

How can I fix this?


Solution

  • In routes, I put

      mount EngineName::Engine => "/path_to_engine", :as => "engine_name"