Practical.REST.on.Rails.2.Projects笔记

[quote]Apress.Practical.REST.on.Rails.2.Projects.Apr.2008.pdf[/quote]
In any application I intend to deploy to a production environment, I generally install the
[b]exception_notification plugin[/b] 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/

[b]restful_authentication[/b]

[quote]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.[/quote]

ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication
ruby script/generate authenticated user sessions

[b]DEBUG[/b]
--------------------------------------------------------------------
Page 41 发现一个问题
Go ahead and create a new user here 当我用safari发送一个创建新用户请求的时候提示 [quote]ActionController::InvalidAuthenticityToken[/quote]找了一下发现处理方法在 rubyonrails api中有
原地址:[url]http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html[/url]

[quote]
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
[/quote]


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中写了说明[quote] # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
# map.root :controller => "welcome"[/quote]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值