mardi 25 octobre 2016

How does Rails View Helper work

I recently came across a tricky situation related to rails view helpers. The situation is like follows-

I am having a controller as Feature1::Feature1.1::Feature1.1.1Controller. The Feature1.1 also includes other controllers like Feature1.1.2Controller, Feature1.1.3Controller...

So ofcourse related view helpers in folder app/helpers/feature1/feature1.1/...

Now the real problem I am facing is that a few helpers for feature1.1 includes the same method name method1 with related definition.

I was wondering how rails identifies all these helpers as I am noticing that the method1 i.e. being called in a view for the controller feature1.1.1 is using the definition of the method1 i.e. written for the controller feature1.1.2.

So does rails consider all helper modules defined in one folder as one?

In a view feature1/feature1.1/feature1.1.1/index I am making a method call for method1.

I am using rails3

Aucun commentaire:

Enregistrer un commentaire