ApplicationHelper is not a parent of SomeHelper?

i have:

file application_helper.rb

module ApplicationHelper
def load_components
@right_sidebar = ‘some stuffs’
end
end

file user_public/blog_helper.rb

module UserPublic::BlogHelper
def load_components
ApplicationHelper.load_components
@right_sidebar += ‘{blog archive}’
end
end

the problem is, i want to load the ApplicationHelper.load_components
method from the BlogHelper.load_components method – but apperently the
application helper is not the root of the blog helper. so how can i
access it?
thanks in advance

Hi –

On Sat, 30 Sep 2006, Adrian L. wrote:

file user_public/blog_helper.rb

access it?
You can use ‘super’:

module UserPublic::BlogHelper
def load_components
super
@right_sidebar += ‘{blog archive}’
end
end

super searches the object’s method lookup-path for the next-found
method with the same one as the one that’s being executed. In this
case, it will find the load_components defined in ApplicationHelper.

David


David A. Black | [email protected]
Author of “Ruby for Rails” [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB’s Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org

unknown wrote:

Hi –
You can use ‘super’:
thank you
i was mistaken super for parent previously (oh silly me, it’s such a
simple problem)
thanks! :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs