Praveenkumar
Praveenkumar

Reputation: 981

How to include ActionView::Helpers in rails controller?

Following is my code.

class PropertyDetailsController < ApplicationController
  include ActionView::Helpers

  #Action methods.
end

But the above code is throwing following error when I try to run.

Module::DelegationError (ActionView::Helpers::ControllerHelper#action_name delegated to controller.action_name, but controller is nil: 

Any Suggestions.

UPDATE Is that true if we use params and session we cant include ActionView::Helpers

Reference: http://alphahydrae.com/2013/06/rails-3-rendering-views-outside-a-controller/

Upvotes: 1

Views: 1258

Answers (1)

arjun
arjun

Reputation: 1614

I believe you have to require 'action_view'

Upvotes: 1

Related Questions