Nops, procs can't be serialized, but you could (at your own risk) serialize a string with the code and then eval it.
- Maurício Linhares http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr On Wed, Jul 8, 2009 at 11:37 PM, Jeffrey L. Taylor<[email protected]> wrote: > > Quoting maurizio de magnis <[email protected]>: >> >> Hello everyone, I need to implement first level permalink style url >> routing inside my rails application, ie: >> /first_link.html >> /another_one.html >> ... >> /last_one.html >> >> 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 >> permalink.app_action >> permalink.app_action.app_controller >> >> 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 >> def drive() >> permalink = Permalink.find_by_url(params[:permalink]) >> # TODO HERE >> end >> end >> >> 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've not tried it, but can Ruby proc objects be serialized? If so, just store > the appropriate method call, and call it after setting params[]. > > HTH, > Jeffrey > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

