Different application.rb files for different scenarios?

Hey :slight_smile:

I’ve created a CMS-like pages system, that renders dynamic content by
picking up failed urls using a route,

Catch all that wasn’t routed, and send it to the dynamic page

content renderer:
map.connect ‘*absolute_url’,
:controller => ‘content’,
:action => ‘page’

In /app/controllers I now only have:

/app/
controllers/
manage/
pages_controller.rb
…and many more…
application.rb
content_controller.rb

The manage subfolder is for the backend. Everything frontend is
generated by the content_controller.

The application.rb provides filters, login functionality and more for
ATM both the frontend and the backend. I’d like to separate this, so
that I’d have for instance an application.rb file that works like it
does now, then an application_frontend.rb, and an
application_backend.rb.

I thought I could add a module, ‘/lib/application_backend.rb’ and then
do,

include ApplicationBackend if self.class.controller_path.gsub(//.*
$/, ‘’) == ‘manage’

but then I get ‘undefined method `controller_path’ for Class:Class’…

Is there any way to do what I want to do here? I’m not sure how to go
about it.

Thanks in advance for any tips,

Daniel :slight_smile:

You don’t have to use application.rb, you can create any controller
class you wish and inherit from that class. For example,

class PagesController < ApplicationFrontendController

end

class MorePagesController < ApplicationFrontendController

end

class OtherController < ApplicationBackendController

end

class ApplicationFrontendController < ApplicationController

end

class ApplicationBackendController < ApplicationController

end