Disable controller pattern-matching in some cases

53 views
Skip to first unread message

Jeffrey Gelens

unread,
Jan 10, 2014, 3:11:02 PM1/10/14
to chica...@googlegroups.com
Sometimes I want a certain controller action only to be available using the route I define in priv/my_application.routes and not using the default controller pattern matching. Is this currently possible?

Thanks.

Jeffrey

Jeffrey Gelens

unread,
Jan 15, 2014, 3:54:39 AM1/15/14
to chica...@googlegroups.com
nobody? :(

Evgeny M

unread,
Jan 15, 2014, 3:11:25 PM1/15/14
to chica...@googlegroups.com
Impossible, if I understand you right. In case when there's a route in routes file, the default route (pattern matching) should either redirect to the route from routes file or return 404. This is impossible now.

среда, 15 января 2014 г., 12:54:39 UTC+4 пользователь Jeffrey Gelens написал:

Igor Clark

unread,
Jan 15, 2014, 3:13:02 PM1/15/14
to chica...@googlegroups.com
Hi Jeffrey, sorry, I don't know, but it's something I've wanted to do at times too. I've ended up just writing all the routes I can to try and override anything happening automatically, but it hasn't always been successful, so I'd also be interested to know the answer.

Cheers
Igor

Lucas Introne

unread,
Jan 21, 2014, 11:11:37 AM1/21/14
to chica...@googlegroups.com
Jeffrey, I'm not sure about your use case, but if you're only doing it in specific instances, then I suppose it's entirely possible to check the URL either within the action or within a before filter and return not_found if the URL follows the default pattern.  You can use Req:path() to get the URL of the current request without any query args.

Hope this helps,
-Lucas-


On Friday, January 10, 2014 3:11:02 PM UTC-5, Jeffrey Gelens wrote:

Jeffrey Gelens

unread,
Jan 24, 2014, 4:59:00 AM1/24/14
to chica...@googlegroups.com
Ah, didn't think of that. I guess that will work for now. Thanks!
Reply all
Reply to author
Forward
0 new messages