I have a method that I want to be able to access from the view and from the controller. Where do I put it? If I put it in a helper it works for the views but not the controller.
on 2007-06-18 22:27
on 2007-06-19 00:15
What the function is doing exactly? I guess if it is related to an object, putting it in your model woud work. If it is not, then perhaps in the controller? Without knowing what does the function it's hard to get the logic that you should apply. Chewbie On Jun 18, 3:27 pm, David Modernfossil <rails-mailing-l...@andreas-
on 2007-06-19 00:25
The functionality of the method is not relevant. I am simply trying to better understand the context in which methods can be called and used. I have a method that needs to be accessed from both the views and the controller. Currently if you want to access a method in the views you put the method in the helpers. IF you want to access a method in the controller you have to put it in the controller. The question is - how do I access the same method from both the controller and the views?
on 2007-06-19 01:25
i found the solution... place this at the top of the controller: helper_method :myMethod