How to create local subroutines properly in rails?

hi guys,

Using breadcrumbs on rails (
breadcrumbs_on_rails), I have added a method, “set_breadcrumb” in my
application controller.

That will set up my home breadcrumb.

In my other feedbacks controller, I have the same “set_breadcrumb”
method (in a before_filter). The breadcrumb added here is called

the problem is that when the app runs and I load
I get
“feedback > feedback” as the breadcrumb.
What’s happened is that rails got confused and is looking at the most
local copy of the “set_breadcrumb” method.

I think part of the solution is to use a “self.set_breadcrumb” but
couldn’t find more to read up on…

My question is, how do we localise a method in a controller such that
when I call “:before_filter” in that controller, the local version is
used, whilst when the application controller calls the same method, it
uses the copy that is defined in the application_controller itself?

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