Shift-JISでページ表示、Oralceに登録

class ApplicationController < ActionController::Base
  
  model :cart
  model :line_item
  
	before_filter :set_charset
	before_filter :configure_charsets

	def set_charset
# 	@headers["Content-Type"] = "text/html; charset=utf-8"
		@headers['Content-Type'] = 'text/html; charset=Shift-JIS'
		suppress(ActiveRecord::StatementInvalid) do
			ActiveRecord::Base.connection.execute 'SET NAMES SJIS'
		end
	end

	def configure_charsets
#		@response.headers["Content-Type"] = "text/html; charset=utf-8"
		@response.headers["Content-Type"] = "text/html; charset=Shift-JIS"
# Set connection charset. MySQL 4.0 doesn't support this so it
# will throw an error, MySQL 4.1 needs this
#		suppress(ActiveRecord::StatementInvalid) do
#			ActiveRecord::Base.connection.execute 'SET NAMES UTF8'
#		end
	end  
 
  # Set the notice if a parameter is givem, then redirect back
  # the the product listing
  def redirect_to_index(msg = nil)
    flash[:notice] = msg if msg
    redirect_to(:action => 'index')
  end

	def authorize
		unless session[:user_id]
			flash[:notice] = "Please log in"
			redirect_to(:controller => "login", :action => "login")
		end
	end
	
end