引用
Apress.Practical.REST.on.Rails.2.Projects.Apr.2008.pdf
In any application I intend to deploy to a production environment, I generally install the
exception_notification plugin at about this point. Exception_notification modifies your application so that
any unhandled exceptions in production automatically generate an email to whomever you specify, helping
you to keep track of problems as they occur.
you can install it by running this command:
ruby script/plugin install
http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/
restful_authentication
引用
Since restful_authentication was originally released, the best practices of RESTful Rails development
have diverged a bit from those illustrated in the plugin—and as of today, it is still being updated to
reflect the new trends. As such, it’s not a perfect model for the whole of the MovieList application, but it provides
an excellent starting point and is not so different that it is harmful.
ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication
ruby script/generate authenticated user sessions
DEBUG
--------------------------------------------------------------------
Page 41 发现一个问题
Go ahead and create a new user here 当我用safari发送一个创建新用户请求的时候提示
引用
ActionController::InvalidAuthenticityToken
找了一下发现处理方法在 rubyonrails api中有
原地址:
http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html
引用
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
class FooController < ApplicationController
# uses the cookie session store (then you don't need a separate :secret)
protect_from_forgery :except => :index
# uses one of the other session stores that uses a session_id value.
protect_from_forgery :secret => 'my-little-pony', :except => :index
# you can disable csrf protection on controller-by-controller basis:
skip_before_filter :verify_authenticity_token
end
--------------------------------------------------------------------
Page 63修改首页
map.root :controller => 'movies',:action => 'index'
这样修改首页还没变,原来还要删除public/index.html在route.rb中写了说明
引用
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
# map.root :controller => "welcome"