I have a Rails 3.0 metal class that is in app/controllers directory.
class FooMetalController < ActionController::Metal
include ActionController::Cookies
include ActionController::Helpers::ClassMethods
include ActionDispatch::Session::CookieStore
def hit
unless cookies[:user_id].nil?
logger.info("Cookies value is : #{cookies[:user_id]}")
redirect_to "http://www.yahoo.com"
else
cookies[:user_id] = { :value => "198", :expires => 180.days.from_now }
redirect_to "http://www.google.com"
end
end
end
When I hit the url with: http://localhost:3000/foo
, the hit
method gets called. The problem is that it is not able to use the cookies method. I have included modules related to cookies, still I am getting : ActionController::RoutingError (undefined method `helper_method' for
error message.
How do I make a Rails metal class recognize the cookies method?