Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/governor/rails/routes.rb
Instance Method Summary collapse
-
#governate(*resources) ⇒ Object
Attach a Governor-based resource to your application’s Rails routes.
Instance Method Details
#governate(*resources) ⇒ Object
Attach a Governor-based resource to your application’s Rails routes.
Example:
RailsApp::Application.routes.draw do
# ...
governate :articles
# ...
end
This will attach a controller that will create and modify Article objects.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/governor/rails/routes.rb', line 16 def governate(*resources) = resources. resources.map!(&:to_sym) resources.each do |resource| mapping = Governor.map(resource, ) resources mapping.resource, :controller => mapping.controller, :governor_mapping => resource do Governor::PluginManager.plugins.map{|p| p.routes }.each do |routes| instance_eval(&routes) if routes.present? end end end end |