Module: Desert::Rails::RouteSet

Included in:
ActionController::Routing::RouteSet::Mapper
Defined in:
lib/desert/rails/route_set.rb

Instance Method Summary collapse

Instance Method Details

#routes_from_plugin(name) ⇒ Object

Loads the set of routes from within a plugin and evaluates them at this point within an application’s main routes.rb file.

Plugin routes are loaded from <plugin_root>/routes.rb.



8
9
10
11
12
13
14
15
16
# File 'lib/desert/rails/route_set.rb', line 8

def routes_from_plugin(name)
  name = name.to_s
  routes_path = File.join(
    Desert::Manager.plugin_path(name),
    "config/desert_routes.rb"
  )
  RAILS_DEFAULT_LOGGER.debug "Loading routes from #{routes_path}."
  eval(IO.read(routes_path), binding, routes_path) if File.file?(routes_path)
end