Reputation: 597
I am using this code insite my controller
class ProjectsController < ApplicationController
cache_expire = 60*60*24*365
response.headers["Pragma"] = "public"
response.headers["Cache-Control"] = "max-age=#{cache_expire}"
response.headers["Expires"] = Time.at(Time.now.to_i + cache_expire).strftime("%D, %d %M % Y %H:%i:%s")
render :layout => "application",
:inline => "<script src='//connect.facebook.net/en_US/all.js'></script>"
The caching is working properly, and my webapp does support subdomains.
When I browse to mysubdomain.something.com it gives me an "Routing Error"
undefined local variable or method `response' for ProjectsController:Class
Any suggestions?
Upvotes: 1
Views: 368
Reputation: 230296
This code is supposed to be inside of some method.
def index
cache_expire = 60*60*24*365
response.headers["Pragma"] = "public"
response.headers["Cache-Control"] = "max-age=#{cache_expire}"
response.headers["Expires"] = Time.at(Time.now.to_i + cache_expire).strftime("%D, %d %M % Y %H:%i:%s")
render :layout => "application",
:inline => "<script src='//connect.facebook.net/en_US/all.js'></script>"
end
response
doesn't exist or make sense at class level.
Upvotes: 2