need help deploying rails engine

26 views
Skip to first unread message

jsnark

unread,
Jan 14, 2014, 4:14:55 PM1/14/14
to rubyonra...@googlegroups.com

I'm having problems deploying a rails application that contains engines.

When I had namespaced routes (Engine::Application.routes.draw) in routes.rb, I was unable to get past the "no such file or directory" errors from apache. The request never got back to the application.

When I used global routes (Rails.application.routes.draw) in routes.rb, I can not direct the request to the namespaced controller.  I get "uninitialized constant" with the non-namespaced controller name.

The Getting Started with Engines Rails Guide does not include information on deploying an application containing engines.

The relevant portion of the apache configuration is:

        <Directory /var/www/html/links>
                Options -MultiViews
                RailsBaseURI /links
                RailsEnv staging
                PassengerRuby /usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby
        </Directory>

/var/www/html/links is a symbolic link to the public directory of the deployed application.

A solution to either problem (namespaced or non-namespaced) is acceptable.  A solution with namespaced routes is preferred.

jsnark

unread,
Jan 15, 2014, 10:25:47 AM1/15/14
to rubyonra...@googlegroups.com
Problem solved.

The namespaced paths generated by engine.path need to be modified by prefixing them with the applications base path. I use the apache RewriteRule for this:

RewriteRule ^/engine/?(.*) /app/engine/$1 [R]
Reply all
Reply to author
Forward
0 new messages