Rails relies on the MVC separation to do its job, i.e. the Model handles the database interaction, the View handles the user and front-end interaction and the Controller handles the business logic and flow of the information.
The Helper methods belong to the View tier and normally handle presentation stuff like, formatting text, creating URLs etc. This behavior makes one wonder why would someone try to access the Helper methods inside the Controller if we trust on the fact that each tier should perform only its job.
Well, actually I don't know why, but here is how!
Just go to your Controller class and include the Helper class, like this:
class AccountsController < ApplicationController
# this include will bring all the Text Helper methods into your Controller
include ActionView::Helpers::TextHelper
end
Recent comments
1 day 9 hours ago
1 week 1 day ago
1 week 3 days ago
2 weeks 2 days ago
8 weeks 3 days ago
9 weeks 1 day ago
18 weeks 1 day ago
18 weeks 1 day ago
18 weeks 2 days ago
18 weeks 4 days ago