Forum: Ruby on Rails Different application.rb files for different scenarios?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
3d197df430dbfd0d0b11f23b0a8d3ec9?d=identicon&s=25 Daniel Smedegaard Buus (Guest)
on 2007-04-24 12:30
(Received via mailing list)
Hey :)

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:
       ...and many more...

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

I thought I could add a module, '/lib/application_backend.rb' and then
  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 :)
7c8f8b6eae4dd991e3a9065c68451361?d=identicon&s=25 Wai Tsang (sneptune)
on 2007-04-24 16:27
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

class MorePagesController < ApplicationFrontendController

class OtherController < ApplicationBackendController

class ApplicationFrontendController < ApplicationController

class ApplicationBackendController < ApplicationController
This topic is locked and can not be replied to.