SSL on RAILS

ก่อนอื่นอย่าลืมลง SSL ก่อน ตามนี้

$ script/plugin install ssl_requirement

application.rb —

include SslRequirement

def ssl_required?
  return false if RAILS_ENV == 'development' || RAILS_ENV == 'test'
  super
end

user_controller.rb —

ssl_required :login, :register # :all ก็ได้นะ
ssl_allowed :index # คือจะใช้ ssl ในหน้า index หรือไม่ใช้ก็ได้
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s