hi guys,
basically following the rails plugin guide, i set up a plugin with
routing, controllers, models, etc. now i’d also like to use the link/
url helper to do something like “link_to pluginName_path” or
“redirect_to pluginName_firstPluginController_path”, but just can’t
find out how.
my plugin routes are created from a yml config file which looks like:
defaults:
base_route: :register
process: [:profile, :confirm, :complete]
these routes are created by the plugin like:
module Register #:nodoc:
module Routing #:nodoc:
module MapperExtensions
def register
base_route = “/#{REGISTER_CONFIG[‘base_route’]}”
@set.add_route(base_route, {:controller => “#{REGISTER_CONFIG
[‘process’][0]}”})
REGISTER_CONFIG['process'].each do |step|
@set.add_route("#{base_route}/#{step}", {:controller =>
step.to_s})
end
end
end
end
end
ActionController::Routing::RouteSet::Mapper.send :include,
Order::Routing::MapperExtensions
and included in the app’s routes.rb like:
map.register
this might not be the most beautiful code ever (improvements
appreciated), but it works for now and sets up the following routes
for i.e. an registration process:
/register
/register/profile
/register/confirm
/register/complete
now how can i set up and use link/url helper methods for links or
redirects to each of the steps in the registration process from views/
controllers of the app and from within the plugin?
hope anyone can help!