On Oct 31, 8:28 am, boblu <[EMAIL PROTECTED]> wrote:
> But sometimes, we need some methods that both used in view and
> controller.
> Where do you suggest to put them in?
>
You can make controller methods available to views with helper_method,
or you could have a module that you both include in a controller and
pass to helper (which among other things adds a module to the set of
helpers a view has).
Fred
> On Oct 31, 5:18 pm, Frederick Cheung <[EMAIL PROTECTED]>
> wrote:
>
> > On 31 Oct 2008, at 07:59, boblu <[EMAIL PROTECTED]> wrote:
>
> > > In my project, I have
>
> > > class ApplicationController < ActionController::Base
> > > helper :all
> > > end
>
> > > module ApplicationHelper
> > > def use_module
> > > ### ssss
> > > end
> > > end
>
> > > class B < ApplicationController
> > > def efd
> > > call_private()
> > > end
>
> > > private
> > > def call_private()
> > > use_module()
> > > end
> > > end
>
> > > When I call B::efd(), an error return saying 'use_module()' is
> > > undefined !!
>
> > Helper methods are added to views, not controllers
>
> > Fred
>
> > > I was wonderring why 'helper :all' in my application.rb is not working
> > > at all.
> > > Then I find that this method is depend on 'HELPERS_DIR' variable.
> > > However, when I type this 'HELPERS_DIR' in console, it shows
> > > 'uninitialized constant' error.
>
> > > Does anyone has the same problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---