-1


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?

Patru
  • 4,481
  • 2
  • 32
  • 42
ProkopS
  • 365
  • 2
  • 13
  • You should be more specific on what you are trying to do. Usually the point of having an Admin-portion of a site is _not_ having this functionality in the front-end. Therefore it will certainly not be possible to _inherit_ it from the AdminController (as you would therefore have to create a subclass of it) and it will also be hard to call it without the right credentials. – Patru Feb 28 '14 at 15:07
  • Edited to be more specific. – ProkopS Mar 03 '14 at 09:54

1 Answers1

0

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.

Patru
  • 4,481
  • 2
  • 32
  • 42