読者です 読者をやめる 読者になる 読者になる

restful_authenticationメモ

rails

1. install

script/plugin install http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/trunk
script/plugin install restful_authentication


2. generate

script/generate authenticated user sessions --stateful

メールによるactivationを行う場合は --include-activation も。


3. config/route.rb

map.resources :users, :member => { :suspend   => :put,
                                   :unsuspend => :put,
                                   :purge     => :delete }

4. config/environment.rb

config.active_record.observers = :user_observer


5. app/controllers/application.rb

include AuthenticatedSystem


6. app/controllers/some_controller.rb

before_filter  :login_required