acts_as_authenticatedをインストール
Kuru-MacBook:test_app kuru$ ./script/plugin install acts_as_authenticated
+ ./CHANGELOG
+ ./README
+ ./generators/authenticated/USAGE
+ ./generators/authenticated/authenticated_generator.rb
+ ./generators/authenticated/templates/authenticated_system.rb
+ ./generators/authenticated/templates/authenticated_test_helper.rb
+ ./generators/authenticated/templates/controller.rb
+ ./generators/authenticated/templates/fixtures.yml
+ ./generators/authenticated/templates/functional_test.rb
+ ./generators/authenticated/templates/helper.rb
+ ./generators/authenticated/templates/index.rhtml
+ ./generators/authenticated/templates/login.rhtml
+ ./generators/authenticated/templates/migration.rb
+ ./generators/authenticated/templates/model.rb
+ ./generators/authenticated/templates/signup.rhtml
+ ./generators/authenticated/templates/unit_test.rb
+ ./generators/authenticated_mailer/USAGE
+ ./generators/authenticated_mailer/authenticated_mailer_generator.rb
+ ./generators/authenticated_mailer/templates/activation.rhtml
+ ./generators/authenticated_mailer/templates/notifier.rb
+ ./generators/authenticated_mailer/templates/notifier_test.rb
+ ./generators/authenticated_mailer/templates/observer.rb
+ ./generators/authenticated_mailer/templates/signup_notification.rhtml
+ ./install.rb
acts_as_authenticated generator
DEPRECATED: Use restful_authentication instead. Or, ask me for commit rights if you wish to maintain this plugin.
This is a basic authentication generator for rails, very much in the spirit of xal's original Login Generator.
To use:
./script/generate authenticated user account
This generates a basic user model, a controller, some basic views, and tests. Extra functionality can be unlocked by
removing the comments for them. I have a few examples such as user activation and reversible encrypted passwords.
The user migration is also generated unless you pass --skip-migration.
Generate your mailer:
./script/generate authenticated_mailer user
Consult the Acts As Authenticated wiki for more: http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated
Kuru-MacBook:test_app kuru$
モデルとコントローラーを生成
Kuru-MacBook:test_app kuru$ ./script/generate authenticated user account
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/account
exists test/functional/
exists test/unit/
create app/models/user.rb
create app/controllers/account_controller.rb
create lib/authenticated_system.rb
create lib/authenticated_test_helper.rb
create test/functional/account_controller_test.rb
create app/helpers/account_helper.rb
create test/unit/user_test.rb
create test/fixtures/users.yml
create app/views/account/index.rhtml
create app/views/account/login.rhtml
create app/views/account/signup.rhtml
create db/migrate
create db/migrate/20080717154638_create_users.rb
テーブルを作成
Kuru-MacBook:test_app kuru$ rake db:migrate
(in /Users/kuru/01_Projects/saikaiproject/test_app)
== 20080717154638 CreateUsers: migrating ======================================
-- create_table("users", {:force=>true})
-> 0.0054s
== 20080717154638 CreateUsers: migrated (0.0057s) =============================
Kuru-MacBook:test_app kuru$
実行してみる
この状態で取りあえず動かしてみる。
アカウントを登録する。
http://localhost:3003/account/signup
これでアカウントが登録出来た。
ログインする。
http://localhost:3003/account/login
取りあえず動いているようだが、試しに間違ったアカウントを入力してみる。
存在しないアカウントを入力しLoginボタンを押すとLoginとPasswordのフィールドがクリアされる。
動いているようなので、あとはこれをカスタマイズする。
今日はここまで