Hi,

in my current project I've got a couple of map.resources as such:

map.resources :quote_requests do |quote_request|
  quote_request.resources :request_items
end

Which yields urls like this:

/quote_requests/1/request_items/88

and url helpers like this:

edit_quote_request_path(my_quote_request)

What I wanted was to keep the url helpers as they were, but have a more opaque url, where the names in the url weren't directly tied to the names of my url helpers (you can already specify a different :controller, so that's already opaque). As in:

/quotes/1/items/88

I've written a *very* simple plugin that achieves this and I was wondering if it's something I should bother submitting as a patch - as in, am I the only one?

Here's what the map.resources calls would look like:

map.resources :quote_requests, :opaque_name => :quotes do | quote_request|
  quote_request.resources :request_items, :opaque_name => :items
end

And here's the contents of the plugin:

ActionController::Resources::Resource.module_eval <<'end_eval'
  def path
@path ||= "#{path_prefix}/#{(options[:opaque_name] || plural).to_s}"
  end
end_eval

ActionController::Resources::SingletonResource.module_eval <<'end_eval'
  def path
    @path ||= "#{path_prefix}/#{(options[:opaque_name] || singular)}"
  end
end_eval

Any interest?

Regards,
Trevor

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to