문제


I am using Refinery CMS on Ruby on Rails and I need to know, if it's possible to inherit some method from an admin controller in a front-end controller?

I require the same method in the backend and the frontend, but I want them to redirect differently. From the frontend I want to redirect to a frontend page without a show action and from backend I want to redirect to the show action of the added item.

How?

도움이 되었습니까?

해결책

If you really want to share a method you can always write it inside a module that you include in both controllers, however it might not turn out very nice. As you want to redirect differently you will have to know about both contexts. In the worst case you would switch on the type of controller you are included in, but hopefully you can switch depending on the role of the user, such that you do not need to know about the two controllers in your module.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top