Ruby on Rails 使用 Cookie 的方法

class HelloController < ApplicationController
      def set_cookie
            cookies[:my_name] = "AAAA"
            redirect_to :action => "show_cookie"
      end
      def show_cookie
            my_name = cookies[:my_name]
            render(:text => "Hello #{my_name}!")
      end
end

编程技巧