Hello everyone, I need to implement first level permalink style url
routing inside my rails application, ie:
For each permalink there's an associated record (model: Permalink) so that:
permalink = Permalink.find_by_url("first_link.html")
# the following gives me the action and controller associated to the permalink
to handle the routing of these permalinks I'm forced to use this,
inside my routes.rb:
map.connect(':permalink.html', :controller => "permalinks", :action => "drive")
class PermalinksController < ApplicationController
permalink = Permalink.find_by_url(params[:permalink])
# TODO HERE
the entire site is based on these kind of permalinks, so I'd like to
reroute the execution flow from Permalinks::drive() to the
controller's action specified by the selected permalink.
The only constraint I can't avoid is that I can't use redirect_to
because it would rewrite the browser's url and I need to keep the same
url for the entire request.
How can I achieve this?
(I hope this will be a builtin feature )