This is a common and well-resolved issue.
Rails does not allow controllers to access helper methods. If you want to share a method between your views and controllers, you need to define a method in your controller and then make it available to your views using helper_method :
class ApplicationController < ActionController::Bbase
You can pass more than one method name to helper_method to add additional methods to your controller to your views:
helper_method :current_user, :logged_in? def current_user
source share