Hi all, I'm having some methods in application.rb. I have to use those methods in my model. How can i do that? Thanks in advance.
I think can do like
ins = ApplicationController.new ins.method_name #method_name is any def in pplication controller
But why are you calling controller methods from model
Sijo
I'd agree with Sijo here - if you need controller models in the model, something has gone wrong with your design. Either the methods are really model methods (maybe class methods on the model?), or you're trying to do view stuff in the models. Can you post an example of where you're running into this problem?
--Matt Jones
So move such code to lib folder and include those modules where ever you need using include statement
Sijo
Sijo Kg wrote:
So move such code to lib folder and include those modules where ever you need using include statement
Sijo
Ya i created a file and moved those methods to lib folder and checked. Its working fine.