Just an idea, with out looking very deeply into this:

use
map.resources :users
and run
rake routes

now do
map.resources :users, :active_scaffold => true
and run
rake routes
again.

you will see all of the extra routes that putting :active_scaffold => true
creates.

after doing this you could create all of these routes manually using your
reg ex.
when you are done remove the :active_scaffold => true

On Mon, Feb 9, 2009 at 4:56 PM, JChang <[email protected]> wrote:

>
> Hi, i have a, probably, simple problem requiring a simple solution. I
> simply want to add a regexp for the id, so that a username can be used
> as the id, instead of just an integer. I did that by adding this to
> routes.rb:
>
> map.resources :users, :active_scaffold => true, :requirements => { :id
> => \[\w+\] }
>
> I can now click each of the default "Edit" "Delete" and "Show" action
> links in the default list view.
>
> However, if i want to "Close" the details of a row, after clicking the
> "Show" button above, i get the following error:
>
> ActionController::RoutingError (No route matches "/users/tim/row" with
> {:method=>:get}):
>    /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> routing/recognition_optimisation.rb:66:in `recognize_path'
>
> etc. etc.
>
> If i change my URL to something like "/users/1/row", then it
> recognizes the route, but of course, fails to find the record with
> username == 1.
>
> Seems like there should be a simple solution to this, however, i am
> not able to find it. Can anyone help? Thanks!!!
>
> Jae
>
> >
>

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

Reply via email to