灰色的灵魂

黑夜给了我黑色的眼睛, 而我注定要用它来寻找美金

灰色的灵魂 header image 1

继续混乱中

May 24th, 2009 · Life

两个月没有更新blog,理由是忙,但实际原因永远不会是因为忙得没有时间。花了太多时间在焦虑状态中,搞得心理很疲劳,压力很大,事情却没能做完多少,愈发发现一个人在家工作其实要求是很高的。虽然现在有电话,邮件,im,视频会议,skype,但是每天面对面的交流和随时可以沟通的好处是非常之大的,以后还是尽量避免远程工作,能用电话Skype就不用IM邮件,因为时差早晚开会也是很麻烦的一件事情,让生活和工作完全无法割裂。前两天正好看见一篇文章说个google的员工因为签证问题在加拿大和美国团队共同工作,也是对这种工作方式有很多抱怨,的确是没效率。

轻诺寡信,之前承诺了太多事情,结果不能好好完成每一件托付,比拒绝更加糟糕。要学会坚决拒绝必然失败的事情,还有就是,同时最多做两件事,再多的话,虽然工作量没多大,但是太容易互相感染,造成结果是一事无成。之前因为闲着养成的早睡早起生活健康的习惯再次遭到破坏,真是糟糕。

回头看看原来的打算,发现再次是被生活推着走,其实完全没计划,想想要是真的愿意十年磨一剑,必然能有点小成就了,可惜总是被眼前利益诱惑,结果做出来的都是四不像,浮躁啊浮躁。

这篇不是写给别人看的,写给我自己看吧,如果这是我生命中的最后一天,肯定就给每个人打个电话了,如果还有一个月,就出去玩了,可是如果还有5年,我该做什么?如果还有10年呢?如果幸运还有50年呢?

→ 3 CommentsTags:

Rails Magazine可以下载了

March 15th, 2009 · Life

这里可以下载,呃,不知道2009会不会是Rails再次爆发的一年?

→ No CommentsTags: ·

广告后继

February 28th, 2009 · Life

对于你需要天使投资么?的补充:

在杭州和北京的民工们可以在以下时间地点来参加:

  • 3月3日 晚6:00-9:00 浙江大学紫金港校区国际会议中心139
  • 3月4日 晚6:30-9:00 清华大学西阶报告厅(清华大学二校门北200米左右,清华大学大礼堂西侧。可乘校内公交到二校门,步行至西阶)

→ No CommentsTags:

你需要天使投资么?

February 24th, 2009 · Life

广告一则:

Trilogy Ventures 创业沙龙(互联网 手机应用方向)
Trilogy Ventures
时间:3月2日18:00-21:00
地点:上海交通大学闵行校区光彪楼

欢迎去玩。

Update:补充一下,Trilogy去年和前年各投了一家,今年估计机会会多一些,因为专门成立了Trilogy Ventures China专门投早期,此外,当天Speech胜者貌似有3000块奖金。

→ 3 CommentsTags:

重要的是持续改进

February 22nd, 2009 · Life

其实开发过程中重要的不是采用了什么样的工具,流程甚至理念,重要的是作为开发人员开发团队应该把精力花在是你的开发变得更好上。无论是你喜欢XP这样的理念,还是因为喜欢Joel而简单地使自己的流程符合Joel Test上,这些问题出现的本质是让你把精力放在把事情变好而不是只是在做做事情。每日构建、单步构建和自动测试是把你从每天“做做构建”、“做做测试”这样的事务中解脱出来;使用源代码管理是让你避免浪费时间去反反复复做做过的事情;不要加班是让你意识到你要做得是效率上得改进而不是重复劳动来做体力活。无论是不是已经有了这些流程,开发人员始终可以做的是每天把精力花在使今天比昨天好上面。只要你有意识去花时间进行改建,那么你之前没有用源代码管理你自然会发现花了很多时间做出来得东西被猫吃了;你没有为每个bug添加test case自然会发现同一个bug会反复出现;你没有用单步构建和每日构建自然会发现每次要发布得时候都会手忙脚乱要通宵加班。而有了这样的意识,即使你已经符合了Joel Test的12条你仍然可以发现你可以使用自动发布来让客户看到每天的开发结果;你可以使用创建VM Image来解决不同开发人员开发环境不同,可能有遗漏的依赖没有放入源代码管理中;你会发现Git比SVN更好地解决了开branch的开销和常常需要它记录一部分不完整代码的问题。

所以,重要的是始终在开发过程中保持持续改进的意识,工具和方法论反而是第二位的。

→ No CommentsTags:

有些事情说起来简单

February 22nd, 2009 · Life

比如始终保持一颗初心,比如走自己的路,让别人打车去吧,比如但行好事末问前程,比如不要后悔始终向前看,比如follow your heart。但是修炼自己的心性实在不是一件简单的事情,很痛苦很压抑。可是很多事情不能不做,不能不压抑。很多时候鱼和熊掌不能兼得,但是真不知道该取何者舍何者。

→ 1 CommentTags:

Tool到用时方恨多

February 22nd, 2009 · Life

越来越发现,这个时代实在是工具太多了,多到有点让人讨厌了。随便干点什么,都要会一堆东西;学点新东西,发现要能用要再学一堆新东西。最近用ROR做点东西,发现真要做点Production Quality的东西,至少要用一堆工具,比如New Relic,比如Capistrano,然后如果想要用得爽还有一堆RSpec等等的东西可以用,更不用说HTML/CSS/Javascript/MySQL/Git这些基本的工具。如果在Java世界的话,用的东西更是多到让人厌恶。比起要用的工具,人生时间实在是短到让人绝望,不过没办法,只能慢慢玩了……

→ No CommentsTags: ·

我的IT环境

February 21st, 2009 · Life, Tech

科技越来越发达,工具越来越多,每天的生活都要和你的电脑、软件还有互联网服务打交道。这篇,就来说说我现在常用的软硬件工具和服务:

笔记本一之N610c:毕业没几个月买了台二手的N610c,然后抛弃了原来的拼装台式机。可惜我买二手的东西寿命都不长,现在这台机器通常作为我的第二显示器在写东西需要参考的时候开着,干活是已然不行了,因为南桥主板芯片出了问题,USB口不工作了,电池也充不进电了。
这台机器系统是XP,基本只装了Firefox和Adobe Reader,因为主要用来看看东西啦。

笔记本二之Macbook 466:去年底离职之后把工作电脑上交了,然后立马去买了台新的铝壳麦书,很好用啊很好用,虽然从价格上来说不便宜,摄像头蓝牙都有,多点触控很方便,用惯了改用windows有时候还真有点不习惯……
这台现在是日常工作机了,每天开机自启动的是Skype和Adium,Adium的好处是可以整合多个IM,不用再MSN+ICQ+QQ+Gtalk开四个IM浪费内存了,而且Adium可以让你整合多个IM的分组,同时将不同IM上的同一人的多个帐号合并在一起,非常方便,不用再一个个IM看某人是否在线了。然后浏览器日常用的是Firefox,当然也装了Safari和Opera测试的时候用用,Firefox里的插件装得不多,发现其实天天要用的也就那么一点,目前只有Adblock Plus,Firebug,Google Gears,Google Toolbar,GreaseMonkey,Remember the Milk for Gmail,Web Developer,wmlbrowser和Zotero。写代码目前主要在玩Ruby和Rails,所以找了个Textmate用用,一直在考虑要不要花钱买下license,当然Eclipse和Netbeans也都装了,自带的Xcode也在,不过Netbeans和Xcode基本没用过;装了Subversion和Git作为SCM的客户端,当然,慢慢习惯用Git之后我觉得SVN可以抛弃了。日常的照片音乐都交给了自带的iLife,看PDF也是用的Preview,反正对我来说已经足够好了。看片用Mplayer 1.0,下载各大盗版则是Amule+Transmission。常常会用到自带的Stickies来记录点东西,自带的Dictionary也很好用,虽然装了QuickSilver,但是我还是更习惯Spotlight,不过貌似这玩意儿有越用越慢的趋势。当然,为了上网上银行,还是搞了个VMWare的Windows虚拟机的。

手机一之Nokia 6630:也是毕业没多久买的,到现在还正常工作。手机有强烈的诺基亚风格,就是难看,但是皮实经摔好用,电话短信不会有问题,也不会死机重启之类,电池也能撑三四天。买的时候也算是当时的牛机了,现在看上去则是连山寨也不如了。刚买那会儿装了不少软件折腾,还拿这个看电影听MP3啥的,现在上面只有三个非自带的软件,分别是A4输入法,MSN和UCWeb。意欲装Frings在手机上控制所有IM可惜它不卖面子始终没法用,而UCWeb则是战胜了Opera Mini占据了手机上的位置,常常用它在老婆逛街的时候看看Google Readers里订阅的内容。还值得一提的是,这台机器通过Google Sync可以把Gmail里的Contacts和手机上的双向同步,方便了备份和转移电话本了。

手机二之Blackberry 8310:去年买的号称全新机,看到号称这两个字你就知道是翻新机了,在不长的时间里已经出了两次问题,这不前两天又拿到JS那里去修了,每次买二手的东西,我的RP都很差,所以下定决心以后不碰二手的东西了。虽然常常不能好好用,但是不可否认Blackberry是设计优良的机器,虽然用不上push mail费了一半,但是这台机器通过Google Sync可以同步联系人之外,还能同步Calendar,然后买了Remember the Milk的Pro服务还能同步Todo list,就可以完全把PIM的功能随身携带。另外,上面的Gmail的客户端也很不错,因为是全键盘,通过快捷键操作还是非常方便的。还有个好处是开软件不像其他机器那么费电,机器的按键和滚轮手感也不错,现在我就希望这台机器这回修好别再出问题了。

MP3之iPod shuffle 2:一台银色的夹子shuffle,不该买的,话说这其实也是台二手的,新蛋上买的,不过用的实在不多,浪费了,话说二手真是我的诅咒啊。

互联网服务:Mail自然毫无疑问是Gmail。然后是一系列的Google服务,因为Google Reader的分享功能用它替代了Bloglines;用Google Docs做读书笔记或者整理各种零散的笔记;用Google Calendar做日程表,虽然最近没什么计划性。然后Todo list因为Google自带的实在是不太好用,所以用的是Remember the Milk,装了Firefox的插件所以可以和Gmail很好地整合。Blog是host在Dreamhost上的,然后代码则是用Github取代了不稳定的Google Code

看了看,发现自己用的东西还是很简单的,同学们也来分享一下自己用的软硬件和服务吧。

→ 3 CommentsTags:

配置Rails应用

February 13th, 2009 · Life

译者注:本文原文来自Rails Guides,版本为January 3, 2009: First reasonably complete draft by Mike Gunderloy。本文根据原文,按照Creative Commons Attribution-Share Alike 3.0授权。

本指南涵盖了可用于Rails应用中的配置和初始化特性。通过本指南,你可以
1.调整Rails应用的行为
2.添加在应用启动阶段运行的代码

本指南的第一版是基于Rails 2.3的源代码撰写的。虽然不保证向前兼容,但是本指南涵盖的信息可广泛地用于Rails 2.2。

1. 初始化代码的位置

Rails(至少)提供了五个好位置来放置初始化代码:

  • 预初始化器(preinitializers)
  • environment.rb
  • 针对特定环境的配置文件
  • 初始化器(load_application_initializers)
  • 后初始化器(After-Initializers)

2. 使用预初始化器

Rails允许你使用一个预初始化器,在框架自身被装载前来运行代码。如果你把代码存放在RAILS_ROOT/config/preinitializer.rb中,这些代码会在任何框架组件(Active Record, Action Pack, and so on)之前第一个被装载。如果你想要改变任何初始化过程中某些类的行为,你可以在这里(preinitializers文件)做。

3. 配置Rails组件

基本上来说,配置Rails所做的工作就是配置Rails自身以及配置Rails的各个组件。environments.rb文件以及针对特定环境的配置文件(比如config/environments/production.rb)允许你设定各个组件的设置。例如,默认的Rails2.3中的environment.rb文件中包含这样一条配置:

config.time_zone='UTC'

这是一条Rails自身的设置。如果你想要设定Rails的各个组件的设置,你也可以通过同样的这个config对象来做:

config.active_record.colorize_logging = false

Rails会使用这条设置来配置Active Record

3.1 配置Active Record

ActiveRecord::Base包含许多种配置选项:

  • logger接收一个符合Log4r或者Ruby1.8.x Logger类的接口的logger,该logger会传递给所有的新创建的数据库连接。你可以在ActiveRecord的model类或者其实例上调用logger来获取该logger。把该值设为nil会经用日志功能。
  • primary_key_prefix_type用于设置主键列的命名。Rails默认主键列的名字是id(该配置无需设定),但是你可以有两个别的选择:
    • :table_name会另Customer类的主键为customerid
    • :table_name_with_underscore会另Customer类的主键为customer_id
  • table_name_prefix使你可以在表名的前面设置添加一个全局的字符串。如果你将该值设为northwest_,那么Customer类会映射到northwest_customers表。默认该值为一个空字符串
  • table_name_prefix使你可以在表明的后面设置添加一个全局的字符串。如果你将该值设为_northwest,那么Customer类会映射到customers_northwest表。默认该值为一个空字符串。
  • pluralize_table_names规定了Rails使用单词的单数还是复数来命名数据库中的表名。如果该值被设置为true(默认值),那么Customer类会使用customers表,如果该值被设置为false,那么Customer类会使用customer
  • colorize_logging(默认为true)规定了在ActiveRecord的日志信息中是否使用彩色的ANSI代码。
  • default_timezone决定了在从数据库中读取日期和时间时,是使用Time.local(如果设置为:local)还是Time.utc(如果设置为:utc)。默认值为:local
  • schema_format控制了从数据库中导出数据库模式到文件中所用的格式。选项:ruby(默认值)会使用一个数据库无关的migrations,选项:sql会使用(可能依赖于特定数据库的)SQL指令。
  • timestamped_migrations控制了migrations的数字是使用连续的整数还是时间戳。默认值为true,代表使用时间戳,这在优多人共同开发同一个应用的时候是一个更好的选择。
  • lock_optimistically控制了ActiveRecord是否使用乐观锁。默认该值为true
  • MySQL适配器增加了一个额外的配置选项:

  • ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans控制了ActiveRecord是否认为MySQL数据库中所有的tinyint(1)列为布尔值。默认该值为true
  • 数据库模式的导出器(schema dumper)增加了一个额外的配置选项:

  • ActiveRecord::SchemaDumper.ignore_table接受一个表名的数组,该数组中的表不应包含在任何生成的数据库模式文件中。该设置在ActiveRecord::Base.schema_format == :ruby时才会起作用。

3.2 配置Action Controller

ActionController::Base包含了一些配置设定:

  • asset_host在所有AssetHelper中的辅助方法所生成URL的前面添加一个字符串。这是设计用来将所有的javascript,CSS以及图片文件转移到一个不同的主机(asset host)上。
  • consider_all_requests_local通常在开发环境中被设为true而在生产环境中被设为false;如果它被设为true,则任何错误都会导致详细的调试信息会被导出到HTTP response中。如果你想做更细致的控制,将其设为false然后实现local_request?方法来决定哪些requests会在出错的情况下提供调试信息。
  • allow_concurrency为了允许同步(线程安全的)的action处理,该值应当被设为true。默认情况下该值为false。你通常不应当直接修改这个配置,因为你需要一系列的其他调整使得线程安全模式可以正确地工作做。你可以在production.rb文件中简单地调用config.threadsafe!,它会为你做所有需要的调整。

  • Threadsafe操作和开发模式下的一些功能不兼容。特别是自动的依赖装载和类重装载会在你调用config.threadsafe!之后被自动禁用


  • param_parsers让你可以设置一个handlers的数组,用于提取HTTP requests中的信息并将它放到params哈希中。默认情况下,multipart forms,URL-encoded forms,XML以及JSON的parsers是被激活的。
  • default_charset设定了所有render默认使用的字符集。默认值为"utf-8"
  • logger接收一个符合Log4r或者Ruby1.8.x Logger类的接口的logger,可以被用来在Action Controller中记录日志信息。把该值设为nil会禁用日志功能。
  • resource_action_separator用来设置RESTful url中resource和action之间的分隔符。默认为”/”。
  • resource_path_names用来设置一个RESTful action默认的名字的哈希。默认情况下,new action被命名为new而edit action被命名为edit
  • request_forgery_protection_token用来设置RequestForgery的参数名。调用protect_from_forgery会将它设为:authenticity_token
  • optimise_named_routes打开了一些生成路径表(routes table)的优化。它默认被设为true
  • use_accept_header用于设置确定response格式的规则。如果该值设为true(默认值),则respond_to方法和Request#format方法会根据Accept Header返回相应格式的response。弱该值设为false则request格式会单独由params[:format]来决定。如果没有format参数,则response的格式会根据request是否是一个Ajax request来决定返回HTML还是Javascript。
  • allow_forgery_protection用于设置启用还是禁用CSRF保护。默认在测试模式下该值为false而在其他模式下为true
  • relative_url_root可以被用来告诉Rails你将会将应用部署到一个子目录。默认值为ENV['RAILS_RELATIVE_URL_ROOT']
  • 缓存功能代码将会增加两个额外的设置:

  • ActionController::Caching::Pages.page_cache_directory用于设置Rails为你的Web服务器创建缓存页面的位置。默认值为Rails.public_path(通常该值被设为RAILS_ROOT“/public”+)。
  • ActionController::Caching::Pages.page_cache_extension用于设置生成的缓存页面文件的扩展名(如果进来的requests已经带了扩展名则这里的扩展名会被忽略)。默认值为.html
  • 分发器(dispatcher)包含了这样一条配置

  • ActionController::Dispatcher.error_file_path给定了Rails用来寻找出错文件如404.html的路径。默认值为Rails.public_path
  • 使用Active Record的session存储可以这样来配置

  • CGI::Session::ActiveRecordStore::Session.data_column_name用于设置用来存储session数据的列名。默认值为’data’。

3.3 配置Action View

Action View上只有不多的几个配置选项,从ActionView:Base的四个开始:

  • debug_rjs决定RJS response是否会被包装在try/catch块中,并alert()被捕捉的异常(并重新将其抛出)(译者注:即是否对rjs使用debug模式,使得rjs的异常在开发工程中会被alert显示出来)。默认值为false
  • warn_cache_misses是否在一个action的结果遇到view路径中缓存未命中时Rails会显示一个警告。默认值为false
  • field_error_proc提供了一个HTML生成器来显示来自于Active Record的错误。默认值为Proc.new {|html_tag, instance| "#{html_tag}"}
  • default_form_builder告诉Rails默认实用的表单构建器(form builder)。默认值为ActionView::Helpers::FormBuilder
  • ERB Template handler提供了一个额外的选项

  • ActionView::TemplateHandlers::ERB.erb_trim_mode提供了ERB使用的修剪模式(trim mode)。默认为’-'。查看ERB文档获得更多信息

3.4 配置Action Mailer

ActionMailer::Base上由一系列可用的配置:

  • template_root提供了Action Mailer模版的根目录
  • logger接收一个符合Log4r或者Ruby1.8.x Logger类的接口的logger,用来记录来自Action Mailer的日志信息。设为nil则禁用日志记录功能。
  • smtp_settings用来为smtp邮件发送方式提供详细的配置信息。它接受一个哈希组成的选项,包括如下任意的选项:
    • :address允许你使用一个远端的邮件服务器。请将它从默认的”localhost”改为你所用的邮件服务器。
    • :port如果你使用的邮件服务器不在25端口上运行,请修改这个配置。
    • :domain如果你需要指定一个HELO域名,请在这里指定。
    • :user_name如果你的邮件服务器需要认证,请在这里设置用户名
    • :password如果你的邮件服务器需要认证,请在这里设置密码
    • :authentication如果你的邮件服务器需要人证,你需要在此指定认证的类型。它应该是:plain:login,和:cram_md3三个符号其中之一。
  • sendmail_settings允许你对sendmail邮件发送方式进行详细的配置。它接受一个哈希组成的选项,包括如下任意的选项:
    • :location—sendmail可执行文件的位置。默认为/usr/sbin/sendmail
    • :arguments—命令行参数。默认值为-i -t
  • raise_delivery_errors设置如果邮件发送没能完成是否需要抛出一个错误。默认值为true
  • delivery_method设置邮件发送方式。可以使用的值有:smtp(默认值),:sendmail以及:test
  • perform_deliveries指定邮件是否要真得发送出去。默认值为:true,测试时可以方便地设为false
  • default_charset设定Action Mailer用于编码邮件主题和内容的字符集。默认为utf-8
  • default_content_type设置消息的主体所使用的默认的content type。默认值为text/plain
  • default_mime_version设置消息实用的默认的MIME版本。默认值为1.0
  • default_implicit_parts_order—当一个消息被隐式地构建(例如,邮件的多部分通过模版组装,而模版通过文件名设定了content type),这个变量控制多个部分的顺序。默认为["text/html", "text/enriched", "text/plain"]
  • 。数组中先出现的项在邮件客户端中有较高的优先级,并在mime编码消息的最后出现。

3.5 配置Active Resource

ActiveResource::Base中有一个配置可以设置:
logger接收一个符合Log4r或者Ruby1.8.x Logger类的接口的logger,用来从Active Resource中记录日志信息。设为nil时禁用日志功能。

3.6 配置Active Support

Active Support中有一些配置选项:

  • ActiveSupport::BufferedLogger.silencer设为false则禁用了对代码块的缄默日志(silence logging)功能(译者注:可以参看http://api.rubyonrails.com/classes/ActiveSupport/BufferedLogger.html#M001499,缄默日志使得silence方法可以对指定的代码块屏蔽日志功能或者改变日志的level)。默认值为true
  • ActiveSupport::Cache::Store.logger设定了缓存存储操作所使用的logger。
  • ActiveSupport::Logger.silencer设为false则禁用了对代码块的缄默日志(silence logging)功能。默认值为true

配置 Active Model

Active Model目前有一个单独的配置设置:

  • ActiveModel::Errors.default_error_messages是一个包含所有验证错误消息的数组。

使用初始化器

在装载了框架以及任何gems和插件之后,Rails会开始装载初始化器(initializers)。一个初始化器是在你的应用中任何存储在/config/initializers中的ruby代码。你可以使用初始化器来存放哪些应该整个框架和插件装载后进行的配置设置。

如果你喜欢的话,你可以使用子目录来组织你的初始化器,因为Rails会渗入到initializers目录的整个文件目录层级中去。


如果你的初始化器有任何的顺序依赖关系,你可以通过命名来控制它们装载的顺序。例如,01_critical.rb会在02_normal.rb之前装载。


使用一个后初始化器(After-Initializer)

后初始化器(如同你所猜想的)会在所有的初始化器装载之后运行。你可以通过在任何Rails配置文件中设立config.after_intialize来支持一个after_initialize代码块(或者一个这种代码块的数组)。

config.after_initialize do
    SomeClass.init
end
你应用的一部分,特别是观察者(observers)和路径(routing)在after_initialize代码块被调用时还没有建立好。


Rails环境设置

Rails的一部分配置可以通过外部环境变量来配置。以下的环境变量会被Rails的不同部分识别出来。

  • ENV['RAILS_ENV']定义了Rails所运行在的环境(production,development,test等等)
  • ENV['RAILS_RELATIVE_URL_ROOT']被路径代码用来在你部署你的应用到一个子目录时识别出URL。
  • ENV['RAILS_ASSET_ID']会覆写默认的Rails生成的用户可下载资产的缓存失效的时间戳。
  • ENV['RAILS_CACHE_ID']ENV['RAILS_APP_VERSION']用来生成Rails缓存代码中的扩展的缓存键。这可以允许你对同一个应用有多个分开的缓存。
  • ENV['RAILS_GEM_VERSION]RAILS_GEM_VERSION没有在environment.rb文件中定义时,定义了使用的Rails gems的版本。

→ No CommentsTags: ··

functional tests中的form_authenticity_token

February 9th, 2009 · Life

又是一个前一阵遇到的很tricky的问题。

Rails2.0中加入了form_authenticity_token来防止部分的cross-site的攻击,ActionView中默认的form_for标签会自动加入类似于

的代码,如果你自己使用form_tag来创建form的话,可以用类似于

<input type="hidden" name="authenticity_token" value="<%= "#{form_authenticity_token}" %>" />

的代码来加入这个隐藏的form中的authenticity_token。

但是手工加入这个token在functional tests中会带来问题,因为functional tests中是把allow_forgery_protection关掉的
可以在environments/test.rb中看到这样的配置

config.action_controller.allow_forgery_protection    = false

但是authenticity现在是hardcode在代码中,所以跑functional tests通常会遇到这样的错误

ActionView::TemplateError: No :secret given to the #protect_from_forgery call.  Set that or use a session store capable of generating its own keys (Cookie Session Store).

一种解决办法是在view中加入当前all_forgery_protection状态的判断代码,比如

<% if  protect_against_forgery? %>
<input type="hidden" name="authenticity_token" value="<%= "#{form_authenticity_token}" %>" />
<% end %>

但是有位同学用了个更巧妙的hook的办法,在test_helper.rb中hook掉form_authenticity_token,如下

module ActionController
  module RequestForgeryProtection
    def form_authenticity_token
      return "form_authenticity_token OVERRIDE!"
    end
  end
end

我比较喜欢后一种啦。

→ No CommentsTags: ··

Tramadol News - buy tramadol without prescription tramadol cash delivery no prescription needed tramadol how to get prescription of tramadol tramadol online tramadol for sale no script cheap tramadol cod saturday delivery online tramadol cod pharmacy buy tramadol on line without a prescription overnight tramadol ups cod ultram tramadol hci tablets no prescripton tramadol cheap tramadol cash on delivery cod accepted orders for tramadol no prescription tramadol ups delivered info on 50 mg tramadol tramadol overnight pharmacy cheap fed ex tramadol fee lowest no price tramadol no prescription saturday delivered tramadol order tramadol on internet buy ultram tramadol cheap tramadol delivery tramadol cod free shipping tramadol in mexican pharmacies tramadol pain medicine canadian tramadol tramadol 50 states tramadol sale 100 mg tramadol priority overnight pharmacy online 180 ct tramadol tramadol tramadol 180 tabs tramadol online at next day tramadol 50mg low price info on tramadol offer cheapest tramadol cod buy tramadol online free shipping best price for tramadol generic ultram money order tramadol top site for buying tramadol buy tramadol by cod pay order tramadol overnight cod tramadol overnight online cheap tramadol sales 120 tabs lowest cost tramadol pharmacy buy tramadol tablets without prescription tramadol shipped by cash on delivery order tramadol cheap cheap tramadol cod delivery tramadol cod delivery online pharmacies that sell tramadol Tramadol cheapest us price buy online tramadol by cod tramadol cod free overnight tramadol buy tramadol online with next day shipping overnight tramadol tramadol for sale tramadol drug no prescription tramadol same day delivery buying tramadol without a script tramadol order overnight shipping tramadol pay cod tramadol cash on delivery overnight tramadol c.o.d overnight delivery buy tramadol without tramadol online cash on delivery tramadol cod overnight buy tramadol from a usa pharmacy without a prescription tramadol no dr contact tramadol without script order tramadol online from mexico prescription tramadol cod tramadol ups cod tramadol no doctor prescription cheap tramadol online consultation order tramadol next day delivery buy tramadol no prescription tramadol generic cheapest tramadol online orders tramadol pharmacy saturday delivery discount tramadol overnight online pharmacy cod tramadol buy tramadol online without dr approval buy tramadol without rx buy cheap tramadol no prescription generic tramadol tramadol non prescription tramadol with no presciption overnight cheap tramadol tramadol in mexico without prescription cod tramadol 120 cheap tramadol next day delivery tramadol no script required express delivery fedex overnight tramadol no rx tramadol tramadol cheap next day buy tramadol overnight fedex buy tramadol online tramadol non prescription tramadol overnight no prescription no prescription tramadol tramadol online prescription where can i buy tramadol no prescription pharmacy tramadol no prescrption buy tramadol medication next day fedex shipping for tramadol tramadol no prior prescription low price tramadol without prescription tramadol online no prescription cheap tramadol no prescription nextday shipping tramadol buy fedex tramadol cheap no rx required canada 100 mg tramadol tramadol cod pharmacy no prescription tramadol fedex delivery tramadol shipped cod only cod tramadol for saturday no rx needed for purchasing tramadol tramadol without prescription purchase tramadol uk delivery buy tramadol on line Tramadol orders C.O.D. tramadol no prescription no fees overnigh buy tramadol shipped ups buy tramadol online by cod tramadol cheap overnight fedex buying tramadol overnight overnight delivery of tramadol with no prescription tramadol cod saturday delivery fedex order tramadol online cod tramadol no rx overnight buying tramadol without a prescription no prescription saturday delivery tramadol generic tramadol tablets cheap tramadol fedex tramadol delivered overnight tramadol online without prescription tramadol shipping tramadol with no prescription and delivered over night cheap legal tramadol for sale tramadol next day cash on delivery tramadols overnighted tramadol no script buy tramadol with saturday delivery cheap tramadol saturday delivery order tramadol cheap no membership fees no prescription tramadol 180 pay cod tramadol cod next day tramadol next day no prescriptions needed for tramadol get tramadol cod tramadol ups c.o.d. tramadol cheap fed ex delivery tramadol no rx needed cod accepted cheap tramadol no prescription next day delivery next day delivery tramadol with no script tramadol cod orders by tramadol online tramadol fedex overnight buy tramadol online overnight shipping tramadol tramadol xr online buy tramadol usa cod tramadol without prescription tramadol generic fedex no prescription online pharmacy fedex c.o.d tramadol no prescription tramadol cash on delivery cheap tramadol no prescription fedex tramadol online tramadol without doctor rx non generic tramadol no prescription buy tramadol online no prescription buy tramadol with no prescription us tramadol fedex buy tramadol online Tramadol no prescription Buy cheap tramadol online buy tramadol tramadol purchase on line no prescription fast delivery buy tramadol without a prescription online tramadol free saturday delivery buy cheap tramadol without prescription cod tramadol buy payment tramadol cheap priced tramadol tramadol 180 count by cash on delivery cheap tramadol next day shipping cod tramadol money orders tramadol online uk tramadol overnight delivery saturday very cheap tramadol buy tramadol pay by check buy tramadol pay by cod tramadol saturday delivery no rx cheap tramadol pills online tramadol order pharmacy cheap tramadol no prescription 180ct cheap tramadol india cash on delivery tramadol tramadol delivery cheap tramadol overseas pharmacy buy tramadol online with no prescription buy tramadol by check buy tramadol cheap medication inurl cheap tramadol by money order tramadol money orders accepted cheap tramadol buy tramadol online money order buy tramadol 37.5/325 Mg where to buy tramadol online for real order now ultram 50mg tramadol on delivery buy tramadol money order tramadol money order purchase tramadol shipping online pharmacy no prescription tramadol where can i buy real tramadol online buy tramadol online overnight fedex delivery buy no prescription online tramadol buy no rx tramadol online buy no rx tramadol tramadol shipped no rx tramadol tramadol online fedex priority overnight free shipping on tramadol orders online tramadol tramadol shipped to florida order tramadol Tramadol no prior rx needed tramadol great buy tramadol online cod shipping tramadol saturday delivery best prices on tramadol buy cheap tramadol us online real tramadol online buy tramadol 50mg buy real tramadol online tramadol hcl 50mg buy tramadol hcl 50mg order tramadol hcl 50mg cheap tramadol hcl 50mg tramadol on sale buy tramadol index discount tramadol order now ultram Tramadol no rx online buy discount tramadol order discount tramadol discount tramadol online buy discount tramadol online purchase discount tramadol buy discount tramadol no prescription discount tramadol online no rx get discount tramadol now buy discount tramadol now discount tramadol fast delivery buy discount tramadol free shipping discount tramadol without prescription tramadol cheap no rx free from india buy tramadol with american express tramadol without rx Tramadol free overnight shipping Tramadol and description tramadol hydrochloride tramadol fast delivery buy cheapest tramadol tramadol 120 tramadol overnight shipping tramadol ship to 50 states buy tramadol cheap medication tramadol online si tramadol ultram tramadol online cheap tramadol 50mg medication tramadol hcl cheapest tramadol online order cheap tramadol no rx online buy cheapest tramadol online tramadol hcl order cheap tramadol no prescription tramadol 377 drug use tramadol tramadol hcl 50 mg next day tramadol order cheap tramadol without prescription order cheap tramadol online tramadol ultracet where to buy tramadol cheap tramadol cod order tramadol online cheapest tramadol available online tramadol amex payment tramadol discover card payment tramadol in us pharmacy lowest price of tramadol 180 ct tramadol cheap cheap tramadol fedex overnight tramadol cheap tramadol sales cheap tramadol sales tramadol drug online pharmacy tramadol order cheap tramadol tramadol no prescription tramadol in us pharmacy pay by buy tramadol pay tramadol medicine us tramadol pharmacies for tramadol pay buy cheap tramadol tramadol fedex overnight cheapest tramadol no prescription tramadol pharmacys buy tramadol pay buy tramadol overnight via electronic check need to buy cheap tramadol buying tramadol in us pharmacy tramadol shipping shipping tramadol by money order order tramadol 180 tramadol tablets with tramadol prescription consultations tramadol no prescription required tramadol overnight tramadol overnight fedex tramadol pay by cod real tramadol in us pharmacy 180 ct tramadol online pharmacies tramadol tramadol no consultation fees tramadol shipped with pharmacies tramadol pay pharmacy tramadol 180 ct tramadol payment options cheap tramadol free fedex 180 ct tramadol payment with 180 tramadol cheap by delivery saturday tramadol cheap tramadol overnight free fedex tramadol online tramadol with delivery pharmacies for tramadol pay w phone pharmacies that ship tramadol via pharmacies tramadol pay by ship tramadol to arkansas payment tramadol 180 tramadol cod accepted tramadol india tramadol free overnight cod 180 tramadol 180 tramadol with cod buy cheap tramadol online with cod buy cod guestbook.html inurl tramadol buying tramadol cod buy tramadol online no script with cod buy tramadol saterday del pay cod buy tramadol with cod tramadol 100 mg tramadol 180 by cod tramadol cod cheap tramadol tramadol medication online cod delivery tramadol cod tramadol delivery online tramadol order tramadol hcl with cod pharmachies for tramadol pay cod pharmacies pay by cod tramadol pharmacies tramadol tramadol shipped on saturday tramadol online next day buy tramadol and pay by cod no prescription required for tramadol buy tramadol overnight tramadol with cash on delivery tramadol cash delivery tramadol next day fedex tramadol 100 mg overnight overnight tramadol cod shipping tramadol buy in UK cheap tramadol c.o.d. buy tramadol for saturday delivery tramadol overnight cod cheap tramadol no rx tramadol online fedex cod free consult no prescription next day delivery tramadol 180 tramadol delivered on saturday tramadol overnight delivery cheap tramadol shipped cod on saturday delivery buy tramadol cod us tramadol cod sales low price tramadol no prescription cod tramadol tramadol next day delivery tramadol with saturday delivery tramadol cod delivery next day order tramadol next day delivery tramadol saturday buy tramadol online cash on delivery tramadol for sale cod low price tramadol no prescription buy low price tramadol buy tramadol at a cheap price online buy tramadol overnight cod tramadol no prescription tramadol shipped cod tramadol online purchase tramadol without a prescription and cod delivery order tramadol to uk Tramadol Overnight COD no prescription tramadol without a prescription order tramadol online pharmacies cash on delivery tramadol cod overnight delivery cash on deliver tramadol overnight buy no prescription tramadol buy tramadol cheap tramadol over night order tramadol cod saturday buy tramadol cash on delivery buy tramadol cheap cod no rx tramadol overnight fed ex cheap tramadol prescriptions ordering tramadol online buy tramadol online overseas tramadol cash on delivery order tramadol cash on delivery tramadol no doctors consult Tramadol cheap no rx tramadol overnight no script mastercard accepted online prescription for tramadol tramadol online no prescription overnight order prescription free tramadol canada tramadol no prescription ordering tramadol online no membership overnight delivery free shipping tramadol cheap tramadol without prescription buying tramadol online without prescription purchase tramadol tramadol fedex shipping cheap tramadol without prescription overnight delivery tramadol no rx tramadol without presciption cheap tramadol next day generic tramadol no prescription overnight order tramadol online by fedex tramadol orders cod tramadol free fedex shipping buy tramadol free consultation tramadol online fed ex order tramadol cod tramadol with free dr consultation tramadol free overnight fedex delivery tramadol without a rx tramadol fed ex cheap tramadol online buy tramadol online consultation us tramadol online no script Tramadol medication online pharmacy fedex tramadol buy tramadol without a prescription overnight delivery tramadol without a presciption tramadol with free fedex overnight tramadol prescription online doctor consultation for tramadol only tramadol free consult order tramadol online without prescription tramadol online no prescription tramadol prescription on line buy cheap tramadol overnight buy tramadol order tramadol overnight without prescription buy tramadol online canadian no script tramadol fedex no prescription buy cheap tramadol online cheap tramadol over night buy cheap tramadol online inurl tramadol prescription drug tramadol cod saturday delivery tramadol 50 mg tablets tramadol withdraw tramadol free consultation tramadol without prescription overnight shipping tramadol online with no prescription or membership tramadol prescription from doctors online order tramadol online with cod tramadol no prescription cash on delivery buy tramadol overnight delivery tramadol fedex delivery overnight tramadol cod tramadol cod online tramadol ups buy cheap tramadol 50 mg tramadol rx tramadol rx online order tramadol online no prescription cheap tramadol overnight delivery tramadol on line no prescription tramadol no prescription drug buy tramadol no rx how to get tramadol without tramadol no prescription overnight cod delivery cheap cod tramadol cheap order prescription tramadol online prescription of tramadol cheapest online tramadol buy tramadol 150mg pharmacy order tramadol purchase tramadol without rx discount tramadol overnight delivery tramadol hydrocodone 10mg hydrochloride tramadol tramadol 180 ct cheap overnight delivery tramadol order online pharmacy tramadol 24 hours tramadol 180 tablets ranitidine cheap tramadol no prescription medications cheap tramadol vallium information on tramadol tramadol purchase tramadol drug guide tramadol cheap discount tramadol online accept paypal tramadol hydrochloride synthesis purchase tramadol overnight delivery tramadol no prescription overnight cheap tramadol prescriptions online purchase tramadol online online order overnight tramadol tramadol cheap overnight tramadol 120 pills x 50 mg tramadol dosage zoloft tramadol interactions tramadol 60 pills x 50 mg tramadol 200 tablets pharmacy tramadol hcl dosing cheap compare price tramadol tramadol dod drug tests medication tramadol online tramadol cheap medication pain tramadol buy cheap tramadol on discount tramadol cheap discount tramadol without rx overnight tramadol discount paroxetine hydrochloride tramadol online tramadol purchase online tramadol overnight delivery buy from online texas tramadol online tramadol buy cheap easy tramadol detox diet buy tramadol delivery online prescription saturday tramadol cheap discount tramadol 120 pills tramadol buy tramadol 100 tablets drug hydrochloride inhouse store tramadol tramadol interaction online prescripion cheap tramadol prescription drug tramadol buy tramadol hydrochloride is tramadol a narcotic tramadol drug interaction buy tramadol online cheap tramadol 4 50mg tablets cheap order tramadol discount tramadol buy buy tramadol cheap cod tramadol without prescription cheap online tramadol overnight cheap tramadol 180ct buy prescription tramadol buy tramadol depression buying tramadol online tramadol best buy hydrochloride low cost tramadol tramadol drug utilization review low cost tramadol tramadol canine 150 tramadol tramadol online ordering buy cheap tramadol here tramadol no rx required best buy tramadol cheap online tramadol tramadol withdrawal symptoms tramadol drug screens overnight tramadol cheap prescription tramadol buying online tramadol compare online price tramadol buy tramadol online 150 pills relieving tramadol withdrawal tramadol florida pharmacy online online tramadol tramadol discount tramadol medication no overnight prescription tramadol tramadol and effexor cheap fedex tramadol symptom tramadol withdrawal tramadol cheap overseas cod overnight tramadol overnight delivery tramadol buy overnight tramadol without prescription tramadol best price buy tramadol 200mg cheap tramadol with saturday delivery tramadol cheap easy overnight delivery tramadol discount tramadol pharmacy order tramadol overnight delivery tramadol 270 pills x 50 mg tramadol prescriptions priority overnight overnight tramadol online tramadol 150 tablets tramadol discount codes tramadol hci cheap 120 tramadol 120 buy cheap tab tramadol cod tramadol online buy a tramadol overnight delivery tramadol online snorting tramadol discount tramadol purchase tramadol hcl online link moveto online tramadol tramadol onlines cheap tramadol free delivery pain tramadol hydrochloride ultracet tramadol oxycodone buy fedex tramadol with fedex and no prescription tramadol medicine online without prescription tramadol best cheap tramadol purchase tramadol tramadol antidepressant buy tramadol 400mg prescription and drugs tramadol injection cheap tramadol drugs md online cod tramadol pain medications tramadol tramadol very cheap overnight tramadol purchase buy tramadol apap online tramadol order tramadol and premature ejaculation generic tramadol hcl online online pharmacy tramadol next day tramadol overnight delivery cheap online pharmacy tramadol cheap tramadol free fedex shipping tramadol overseas cheap overnight delivery tramadol what is tramadol hydrochloride discount cheapest tramadol online buy tramadol hcl discount tramadol no rx cheap tramadol free shipping buy tramadol ultram tramadol addiction and withdrawal cheap tramadol with free shipping online prescription tramadol without tramadol 120 tablets tramadol hydrochloride tablets tramadol on line cheap order tramadol without rx online pharmacy tramadol 120 cheap tramadol buy online cheap tramadol overnight tramadol 120 pills x 100 mg buy tramadol cheap price tramadol online free consultation tramadol 180 cheap buy mexico online pharmacy tramadol buy tramadol 37.5 tramadol cheap online tramadol online consultation cheap fedex tramadol very next day delivery tramadol tramadol drug interactions overnight tramadol order online order tramadol order tramadol discount cheap tramadol order cheap discount online tramadol buy tramadol 100mg tramadol 100mg tramadol cheap cod tramadol tablets purchase tramadol without a prescription cheapest tramadol overnight tramadol withdrawal tramadol online overnight shipping overnight tramadol hcl tramadol 180 tablets free fedex tramadol hydrochloride capsules 50mg com buy cheap tramadol purchase tramadol cheap 1 buy cheap tramadol tramadol and prozac interactions tramadol online us pharmacy cheapest prescription tramadol tramadol and overnight tramadol drug screen zantac tramadol tramadol generic tramadol hcl 50 mg tab tramadol online saturday delivery tramadol and online purchase tramadol discount buy tramadol online without a prescription cheap tramadol prices usa tramadol phar]macies 200ct cod cheap discount tramadol free shipping 100mg tramadol buy cheap tramadol 120 tabs tramadol bulk no prescription online cheapest prescription tramadol cheap online tramadol no prescription pain tramadol purchase tramadol no rx tramadol online cod cheap tramadol discount tramadol order generic name tramadol drug testing tramadol prescription tramadol without medicine tramadol drug tramadol tablets buy tramadol drug drug information facts about tramadol cod online tramadol tramadol online discount cheap tramadol cheap tramadol online prescription tramadol online tramadol no rx buy now tramadol tramadol 50 mg 100 tablets online tramadol with free shipping tramadol no prescription florida tramadol generic names drug information tramadol tramadol with no prescription buy tramadol chebr cheap prescription tramadol without buy 150 tramadol tablets prescription what is tramadol weekend orders for tramadol discount tramadol 180 overnight shipping cod tablet tramadol tramadol free shipping overnight buy drug tramadol overnight delivery tramadol purchase best cheap price tramadol tramadol free overnight shipping tramadol no prescription ship to florida tramadol on line prescriptions purchase tramadol without prescription tramadol 50 mg overseas tramadol cheap online tramadol no prescription buy tramadol discount buy tramadol where tramadol pain medication arthritis what is tramadol tramadol online img tramadol and gabapentin order pharmacy tramadol compounding drugs tramadol tramadol cheap no prescription buy tramadol ultracet drug prescription tramadol tramadol acetaminophen 37.5 325mg overnight tramadol without rx buy tramadol 300mg buy tramadol without prescription buy tramadol shipping free tramadol no prescription no consultation tramadol on line online tramadol discount tramadol hydrochloride baikal shop without prescription tramadol online drug test tramadol buy tramadol with paypal overnight tramadol no rx prescription tramadol drug buy information tramadol tramadol hcl for anti depression online tramadol pharmacy 8000 cheap online tramadol under fedex online tramadol cheap tramadol without rx online cheap tramadol prescription buy cheap tramadol 120 cod online tramadol without prescription buy prescription tramadol without cheapest overnight tramadol arthritis medicine tramadol cheap prescription tramadol tramadol prescription online tramadol no prescription needed pain medication tramadol safe tramadol american pharmacy online tramadol without a prescription next day fedex discount tramadol order com online tramadol zenegra tramadol prescriptions pharmacy online tramadol tramadol 30 pills x 100 mg tramadol hydrochloride tablet heap tramadol tramodol tramadol 180 tablets online purchase tramadol 50 mg tramadol tramadol drug information keywords buy tramadol low cholesterol diet cheap tramadol buy tramadol hci tramadol ultracet online accept paypal tramadol cheap price online tramadol free shipping tramadol and drug tests generic tramadol online tramadol prescriptions online saturday delivery cheap tramadol buy tramadol withdrawals tramadol 180 pills x 100 mg tramadol cheap order by 3pm cheap tramadol prescriptions fast delivery order tramadol overnight cheap fioricet medication online tramadol phentermine tramadol viagra tramadol 120 pills cheap overnight tramadol buy cheap overnight tramadol canine tramadol medicine called tramadol buy tramadol twinpharm buy tramadol free shipping tramadol drug medication tramadol no prescription required 200 tablets drug tramadol buy online tramadol overnight tramadol saturday delivery online tramadol without rx tramadol drug addiction tramadol buy on line buy tramadol onlines buy cheap online tramadol drug metabolism inhibition tramadol buy tramadol online from oregon tramadol online pharmacy tramadol 90 pills x 50 mg cheap cod online sold tramadol tramadol cheapest online tramadol c.o.d. saturday delivery tramadol cheap 120 pills 120 cheap tramadol buy cod tramadol cheap discount tramadol 120ct cheap tramadol very order tramadol without prescription controlled tramadol hydrochloride cheap tramadol cod free fedex tramadol generic name tramadol thai pharmacy
Tramadol News - overnight delivery tramadol cheap doctor online prescription tramadol buy tramadol now purchase tramadol overnight buy cheap tramadol overnight only tramadol no prior overnight buy cheap tramadol on line ultracet tramadol tramadol hydrochloride capsules tramadol pharmacies cod tramadol prescriptions cheap tramadol purchase drug interaction tramadol order tramadol no rx hcl medication tramadol no prescription cheap tramadol california discount pharmacy tramadol buy tramadol without a prescription tramadol online discount tramadol 180 cheap cod cheap discount tramadol buy tramadol tablets