File: samples_controller.rb

package info (click to toggle)
liblocale-rails-ruby 2.0.5-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,224 kB
  • ctags: 295
  • sloc: ruby: 727; sh: 22; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 587 bytes parent folder | download | duplicates (3)
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