Module: I18n::BackendDatabase::Routing

Defined in:
lib/routing.rb

Instance Method Summary collapse

Instance Method Details

#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.



7
8
9
10
11
12
# File 'lib/routing.rb', line 7

def from_plugin(name) 
  map = self # to make 'map' available within the plugin route file
  plugin_root = File.join(RAILS_ROOT, 'vendor', 'plugins') 
  routes_path = File.join(plugin_root, name.to_s, 'routes.rb') 
  eval(IO.read(routes_path), binding, routes_path) if File.file?(routes_path)
end