\"home#bla\"" />
开发者

Rails 3 - routing, more parameters

I am thinking about the solution of variable count parameters in URL. In routes.rb I have following

match ":a(/:b)" => "home#bla"

This mean I can have in UR开发者_Python百科L web.com/me, web.com/me/about-me or web.com/me/contact. I would need to add to URL this: web.com/me/one-thing/second-thing => if will be in URL the second parameter one-thing (exactly this string), so then must be there the third parameter (and know on the position of third parameter could be whatever, but always something).

I tried to edit routes.rb* with a following way:

match ":a(/:b/:c)" => "home#something" But this way is wrong...

Could anyone help me, please, how to edit my routes.rb for getting need effect? Thank you so much


How about this?

match ":a(/:b(/:c))" => "home#something"

Otherwise you could do

match ":a(/:b)" => "home#something"
match ":a(/:b/:c)" => "home#something"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜