开发者

Rails post create is redirecting to wrong controller

I've created a category controller in the admin namespace开发者_开发技巧, and have another category controller for the actions which won't modify a category. I'm doing this because I need the admin index and show actions to show drastically different templates in the administrative section of the site compared to the front-facing views. However, Rails by default routes from admin categories new, to non-admin categories create. How can I make new and edit call create and update respectively in the admin categories controller? If anyone has suggestions for a better controller layout, I'd be grateful for some insight to good design practices as well.


you can use routes namespaces. It will help you to keep admin's logic isolated


Unfortunately my problem was very trivial. I should have double checked the URL that my Rails program was loading. I hadn't changed my site's admin page to redirect to admin_categories_path, simply categories_controller. Changing this fixed my issue.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜