Reputation: 171351
helper_method
exposes Controller's method to a view.
Is that possible to expose Controller's method to a model ?
Upvotes: 0
Views: 468
Reputation: 2295
The MVC model is trying to separate code. So if you wanna access code in controllers from model. This means design wise, you may be wrong somewhere. If you wanna share code between controllers and models, it is suggested to put it in to library.
Upvotes: 1
Reputation: 12830
It's possible, but in most cases this is a very, very bad idea.
You may want to define the method in the model, and call it in the controller's action.
Without knowing what you want to achieve, it's hard to give you more detailed instructions.
Upvotes: 1