1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
class SamplesController < ApplicationController
caches_action :cached_action
def index
end
def set_cookie
flash[:notice] = "Cookie lang value is: " + params[:id]
cookies["lang"] = params[:id]
respond_to do |format|
format.html { redirect_to :action => "index" }
end
end
def clear_cookie
cookies["lang"] = nil
flash[:notice] = "Cookie lang value is cleared. "
respond_to do |format|
format.html { redirect_to :action => "index" }
end
end
def cached_action
p "cached_action. This is shown first time only."
end
end
|