hi.
in my routes.rb, I have such url
map.file ':user/:file
it works well with following url:
jay/web
jay/web2
but it encounters error with: jay/web2.0
it displays : no route found to match “/post/web2.o” with
{:method=>:get}
I guess it is because the char ‘.’ and rails can not translate it
exactly.
thanks.it works well now.
but if I want to user such url: jay.zhang/web2.0.
I tried to change the route into:
1.:user => ‘all’, :file => ‘all’ , :requirements => { :user => /./ } , :requirements => { :file => /./ }
2.:user => ‘all’, :requirements => { :user => /./ } , :file => ‘all’ , :requirements => { :file => /./ }
but it seems that it does not take effect.
how to write the route in this kind of situation?
Thanks again.
thanks.it works well now.
but if I want to user such url: jay.zhang/web2.0.
I tried to change the route into:
1.:user => ‘all’, :file => ‘all’ , :requirements => { :user => /./
} , :requirements => { :file => /./ }
2.:user => ‘all’, :requirements => { :user => /./ } , :file => ‘all’
, :requirements => { :file => /./ }
but it seems that it does not take effect.
how to write the route in this kind of situation?
Thanks again.
Best Regards.
Zike Zhang
2007-03-14
From£ºMichael W.
Date£º2007-03-14 00:32:52
To£º[email protected]
Cc£º
Subject£º[Rails] Re: Question:“no route found to match”
zico wrote:
exactly.
Add this to the end of your route:
, :requirements => { :file => /.*/ }
–
Michael W.
–~–~---------~–~----~------------~-------~–~----~
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
-~----------~----~----~----~------~----~------~–~—
yes.i have tested it like , :requirements => { :user => /./, :file =>
/./ }
but the link redirect to the root page automatically if i wrote :
1.jay.zh/web2.0
2.jay.zh
Best Regards.
Zike Zhang
2007-03-14
From£ºMichael W.
Date£º2007-03-14 10:09:28
To£º[email protected]
Cc£º
Subject£º[Rails] Re: Question:“no route found to match”
Zike Zhang wrote:
Michael W.
thanks.it works well now.
but if I want to user such url: jay.zhang/web2.0.
I tried to change the route into:
1.:user => ‘all’, :file => ‘all’ , :requirements => { :user => /./ } , :requirements => { :file => /./ }
2.:user => ‘all’, :requirements => { :user => /./ } , :file => ‘all’ , :requirements => { :file => /./ }
but it seems that it does not take effect.
how to write the route in this kind of situation?
Thanks again.
I haven’t tested it but try something like:
:requirements => { :user => /./, :file => /./ }
–
Michael W.
–~–~---------~–~----~------------~-------~–~----~
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
-~----------~----~----~----~------~----~------~–~—