Hobo / hobo

The web app builder for Rails (moved from tablatom/hobo)
http://hobocentral.net
103 stars 39 forks source link

front_controller generator generates wrong controller inheritance for subsites #101

Open hbaragar opened 10 years ago

hbaragar commented 10 years ago

When the following command is run:

hobo g front_controller admin::front

The new app/controllers/admin/front_controller.rb starts with the following line:

class Admin::FrontController < ApplicationController

when it should start with:

class Admin::FrontController < Admin::AdminSiteController
hbaragar commented 10 years ago

An ugly solution ...

In hobo-2.1.0/lib/generators/hobo/front_controller/templates/controller.rb.erb change the first line from:

class <%= class_name %>Controller < ApplicationController

to:

class <%= class_name %>Controller < <%= ( subsite = class_name.match(/(.*)::/)) ? "#{subsite[1]}::#{subsite[1]}Site" : "Application" %>Controller

Hopefully somebody can find/create a method that does the subsite.

iox commented 10 years ago

Thanks for the code, that makes it much easier!