one thing to note about routes is that the ones that are specified first are
the ones that are applied first, so one thing that you should check is that
the row route that youare trying to create is above the

map.resources :users, :active_scaffold => true


if you still have problems, you can use something like this (I didn't use
your regular expression though)

map.named_route 'row_user', '/users/:id/row.:format', :controller =>
'users', :action => 'row', :conditions => {:method => :get},  :requirements
=> { :id => /.*/ }


On Mon, Feb 9, 2009 at 10:41 PM, Jae Chang <[email protected]> wrote:

>
> I am still a Rails newbie, hence, i think that is part of my problem. :)
>
> The main route that is having an issue is this one from running "rake
> routes" with active_scaffold => true:
>
>                       row_user GET
> /users/:id/row                      {:controller=>"users", :action=>"row"}
>
> This specific route isn't picking up the ":requirements => { :id =>
> \[\w+\] }" for some reason. Thus, if i can override the above route with
> the attached requirements or add it manually, it should get me one step
> closer.
>
> I have tried the following without luck:
>
>    map.resources :users, :action => "row", :requirements => { :id =>
> \[\w+\] }
>
>  map.resources :users, :member => { :row => :get }, :requirements => {
> :id => /[\w+...@]+/ }
>
>  map.connect :users, :member => { :row => :get }, :requirements => {
> :id => /[\w+...@]+/ }
>
> Neither of the above seem to get me the exact same route at the top. I'm
> not completely understanding routing yet. Got any more hints? Thanks again!
>
> Jae
>
> Kenny Ortmann wrote:
> > 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]
> > <mailto:[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