I have done a little more on this.

I learned that all the files in /config/initializers get read, so I
created a new file in that directory, re-define_subsite_name.rb.

When I do it bare - just jumping in with:

     def app_name(add_subsite=true)

... it has no effect.

When I add the prefix:

module Hobo
   module Helper
     def app_name(add_subsite=true)
     ...

(The whole file is at http://pastie.org/2833399)

I get an error at app load time. Passenger says:

[ pid=4588 thr=2151850560 file=utils.rb:176 time=2011-11-08
14:38:27.516 ]: *** Exception PhusionPassenger::UnknownError in
PhusionPassenger::Rack::ApplicationSpawner (undefined method
`add_to_controller' for Hobo::Helper:Module (NoMethodError)) (process
4588, thread #<Thread:0x00000100854480>):

Any ideas?

On Nov 4, 5:06 pm, "[email protected]" <[email protected]>
wrote:
> OK,  I think I need a little more help on this.
>
> I have tried this a few ways but can't seem to get it to change the
> titling of the subsite.
>
> I guess I have two questions:
>
> 1. In what file should I put the redefinition?
>
>   I have tried dryml_taglibs.rb and in application.rb (just above the
> module <appname> line) but neither had an effect.
>
> 2. I am cool with writing the body of the method, but how does the
> definition need to begin? Do I just need to jump in with:
>
>      def app_name(add_subsite=true)
>      ...
>
> or do I need to start with the location of the previous method
> definition as you did, something like:
>
> > > module Hobo
> > >   module Helper
> > >     def app_name(add_subsite=true)
> >>     ...
>
> On Nov 3, 7:58 pm, "[email protected]" <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > Thanks.
>
> > I will do that and check out the source.
>
> > On Nov 3, 7:00 pm, Matt Jones <[email protected]> wrote:
>
> > > On Nov 3, 2011, at 9:24 PM, [email protected] wrote:
>
> > > > I made a subsite that is not an admin subsite and I would like to
> > > > remove the "- Admin" that gets added to the main site name to make the
> > > > page titles for the subsite.
>
> > > > I have searched all through the app source but cannot find where it is
> > > > defined.
>
> > > It's defined in Hobo::Helper (in lib/hobo/helper.rb in the gem). You 
> > > should be able to redefine it in an initializer:
>
> > > module Hobo
> > >   module Helper
> > >     def app_name(add_subsite=true)
> > >       # do something here
> > >       # the default app name is accessible as 
> > > Rails.application.config.hobo.app_name
> > >       # the current subsite's name is available as subsite
> > >     end
> > >   end
> > > end
>
> > > --Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to