rails2.3での認証

8月 23rd, 2012

rails2.3での認証サンプルの覚書。

「Railsレシピブック183の技」からユーザ認証のサンプルを作ってみた。
まずはプラグインのインストール…って最初からつまずく。

ググるとありがたいことに、いっぱい出てきました。
どうやらインストール方法が違うみたい。

参考サイトの手順どおりやったら出来ましたよ。

■コマンド手順

rails sample
cd sample
script/plugin install git://github.com/technoweenie/restful-authentication.git
※ ここでフォルダ名を変更(ハイフンをアンダーバーに変更)
変更前:[project_root]/vendor/plugins/restful-authentication
変更後:[project_root]/vendor/plugins/restful_authentication

ruby script/generate authenticated user sessions
rake db:migrate

あとは、
xxx_controller.rb の「include AuthenticatedSystem」をカットして、
application_controller.rb にペースト。

テスト用ページを作成して実行。
ruby script/server

Leave a Reply