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] Ruby for Rails | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org