RailsConf 2008 Presentation Files和Video收集

阅读71次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-04

Presentation Files@O’Reilly Railsconf 2008 videos@Rails Envy

在功能和ActionMailer测试里运用DRY(不要重复自己原则)-每天一个Rails 2.0特性 #7(译文)

阅读86次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-04

原文:DRY in your functional and ActionMailer tests - Rails 2.0 a feature a day #7 2007年12月27日 在功能和ActionMailer测试里运用DRY(不要重复自己原则)。如果你是一个Test::Unit用户,当你写Rails功能测试(为你的控制器)的时候这样的代码也许看起来很亲切。   class PostsControllerTest < Test::Unit::TestCase def setup @controller = PostsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.n...

生产migration变得容易了-每天一个Rails 2.0特性 #6(译文)

阅读80次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-04

原文: Generating migrations gets easier - Rails 2.0 a feature a day #6   2007年12月24日   你可能还没注意到,Rails 2.0 有了新的方便的语法来生成ActiveRecord migrations。继续运行script/generate migration生成器,我等你。   好了,现在你可以指定你想加到migration里的列通过attribute/type对这种方式传递进去。   script/generate migration AddMoreToAnime episodes:integer licensed:boolean 将会生成这样的migration:   class AddMoreToAnime < ActiveRecord::...

翻译几篇新加坡Cheah Chu Yeow的Rails旧作

阅读70次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-03

温故而知新 Rails 2.0 a feature a day series thx and go to Cheah Chu Yeow 作者在RailsConf 2008上的露面 Chu Yeow from Living on the Edge@RailsConf 2008

ActiveRecord::Calculations里聪明的GROUP BYs-每天一个Rails 2.0特性 #5(译文)

阅读88次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-03

原文:Sensible GROUP BYs in ActiveRecord::Calculations - Rails 2.0 a feature a day #5 2007年12月16日 在ActiveRecord里做分组操作一直都很难以处理。在ActiveRecord和没有测试的edge用例里有许多“魔法”。值得庆幸的是,Rails也有一群目光敏锐的贡献者,他们手头上正在解决没有预见到的错误。 例如,如果你想做: class Click < ActiveRecord::Base belongs_to :site # site_id foreign key is a String, e.g. ‘www.rubyonrails.org’ end # Now, try counting the number of clicks, grouped...

在三秒内连接你的stylesheets和JavaScripts-每天一个Rails 2.0特性 #3(译文)

阅读87次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-03

原文: Concatenate your stylesheets and JavaScripts in 3 seconds - Rails 2.0 a feature a day #3 2007年12月 12日 我不认为我需要解释连接你的5个stylesheets和12个JavaScripts文件进各自单独的文件会使你的页面加载的更快。除非你正使用多能主机(Rails 2允许多能主机),所以那种方法更好说起来很微妙,但我脱离了主题。 有一堆非常有用的插件帮助你捆绑你的JS和CSS文件,他们中大多数也提供对JS和CSS中剥离注释、空格minifying/packing操作。我是个Asset Packager的爱好者,但较新的插件例如PackR 和 Bundle-fu也工作的很好。 在Rails 2.0里,除非你要用minifying/packing/comment-stripping...

ActiveRecord::Base.with_scope { :only => ‘in your model’ }-每天一个Rails 2.0特性 #4(译文)

阅读90次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-03

原文:ActiveRecord::Base.with_scope { :only => ‘in your model’ } - Rails 2.0 a feature a day #4 2007年12月16日 今天的特性揭秘包括经常被错误使用和被误解的with_scope方法。很棒的err.the_blog里有一篇文章,你改如何使用with_scope(是的,只在你的ActiveRecord模型中,而不是控制器和过滤器中)。这篇文章也许是很久以前写的,但在Rails 2.0中仍然适用。 在Rails 2.0里,with_scope方法现在是受保护的,意思就是你不能再在你的controller里使用它(除非你用Ruby 1.9中的#send(:with_scope) 或 #send!(:with_scope)。我甚至不会向你展示如何在控制器里使用它,因为你本来就不应该(除非你...

Time#advance现在用:weeks, :hours, :minutes, :seconds选项-每天一个Rails 2.0特性 #1(译文)

阅读99次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-03

原文:Time#advance now uses :weeks, :hours, :minutes, :seconds options - Rails 2.0 a feature a day #1 2007年12月9日 Time#advance 和 DateTime#advance在Rails 2.0中表现更好。 在Rails 1.2.6和更早的版本中,Time#advance 和 DateTime#advance和只能接受:year, :month 和 :day选项。你也许认为:hours, :minutes 和 :seconds也能正常工作,但是由于代码中的一个bug(见ticket #9818),你只能得到这些内容: time = Time.utc(2000,10,1,10,30,45) # => Sun Oct 01 10:30:45 UTC 2000 time....

控制器中的声明式异常处理-每天一个Rails 2.0特性 #2(译文)

阅读85次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-02

原文:Declarative exception-handling in your controllers - Rails 2.0 a feature a day #2 2007年12月10日 我知道我说过我要试着将这些没有在流行的地方被提及的特性写成“每日一个特性”系列文章,但这个是Rails core之外的贡献者建立的最好的几个特性之一,所以我忍不住提到它。 第一,一个例子 class CommentsController < ActionController::Base rescue_from Comment::Spammy, :with => :moderate_comment rescue_from ActiveRecord::RecordNotFound, :with => :redirect_if_not_found prote...

Rails 2.1新特性

阅读89次,收藏0次,顶0次,踩0脚 | 订阅者:Jason.lee | 来源:Tecker.LOG | 文章作者: | 发表时间: 2008-06-02

 昨天6.1 gem update的时候就发现了rails 2.1,可是现在手上还有个项目在2.0.2上开发,就暂时不更新了。 DHH在blog里列出了2.1的新特性,原文见此,大致翻译如下 Rails 2.1 is now available for general consumption with all the features and fixes we’ve been putting in over the last six months since 2.0. This has been a huge effort by a very wide range of contributors helping to make it happen. 拥有2.0发布六个月后添加的所有特性和修正,Rails2.1现在可供一般需求使用了(就是已发布)。大范围贡献者的巨大努力才使它的实现成...