I made a full engine and converted some plugins to work with the engine (I put them in lib /) and loaded them into the engine.rb initializer
This is the structure:
In the routes in app / config / routes.rb I have:
Rails.application.routes.draw do match 'help', :to => 'help#index', :as => 'help' match 'login', :to => 'sessions#new', :as => 'login' match 'logout', :to => 'sessions#destroy', :as => 'logout' match 'loadtest', :to => 'loadtests#index', :as => 'loadtest' end
In the second route.rb file in (lib / plugin / config / routes.rb) I have this:
Rails.application.routes.draw do match '/mailchimp/callback', :to => 'mailchimp#callback', :as => 'mailchimp_unsubscribe' end
In my engine.rb in config / initializers / I put:
require "#{File.dirname(__FILE__)}/../../lib/plugin/config/routes"
Now when I run rake app: routes, I get this as output:
help /help(.:format) help
How can I add routes from the plugin to engine routes?
source share