E
E
Egor Kazantsev2016-12-25 17:14:53
Ruby on Rails
Egor Kazantsev, 2016-12-25 17:14:53

How to convert Django route to RoR route?

There are such routes on the rail.

match  "/:dist/:category/" => "index#viewcategory",via:[:get],   :constraints => { :dist => /[a-zA-Z\-[0-9]]*/ }  
match  "/:dist/:category/:item/" => "index#viewitem",via:[:get],    :constraints => { :dist => /[a-zA-Z\-[0-9]]*/ }

And there is
url(r'^(?P<slug1>(.*))/(?P<slug2>(.*))/$', 'app.views.view1'),
url(r'^(?P<slug1>(.*))/(?P<slug2>(.*))/page(?P<page>(\d+))/$', 'app.views.view1'),
url(r'^(?P<slug1>(.*))/(?P<slug2>(.*))/(?P<slug3>(.*))/$', 'app.views.view2'),

All is well, of course, but something can not be done:
url(r'^(?P<slug1>(.*))/(?P<slug2>(.*))/page(?P<page>(\d+))/$', 'app.views.view1')
for the rail. I don't even know which way to look. What can be done about it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Kazantsev, 2016-12-26
@saintbyte

match  "/:dist/:category/page(:page)/" => "index#viewcategory",via:[:get],:constraints => { :dist => /[a-zA-Z\-[0-9]]*/ }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question