News In EdgeRails
Luciano9esu
这个作者很懒,什么都没留下…
展开
-
Extend Your ActiveRecord Association Methods
ruby 代码 class Organization < ActiveRecord::Base has_many :people end 当我们声明has_many关系之后,Rails会自动添加一系列的方法,我们就可以在程序中使用organization.people,organization.people.create,organ...2007-08-20 11:18:13 · 58 阅读 · 0 评论 -
Whats New in Edge Rails: Partials Get Layouts
ruby 代码 class='box'> published on 更加dry的方法,在Ryan的文章提到,rhtml和rxml也要被慢慢舍弃了,转而使用erb和builder分别对应。 ...2007-08-20 17:57:15 · 79 阅读 · 0 评论 -
Whats New in Edge Rails: Mime::Type Convenience Methods
在需要知道request的mine类型的时候,可以使用一些新加入的方法方便的来做:ruby 代码 class MyController < ApplicationController # Toggle authentication method based on request type before_filter d...2007-08-20 18:03:32 · 109 阅读 · 0 评论 -
Whats New in Edge Rails: Expanded Caching Scope
对一个model的查询结果进行缓存:ruby 代码 User.cache do me = User.find(1) # DB hit again = User.find(1) # Cache hit end block中的查询结果将会被缓存。假设某个查询关联到多个model:ruby 代码 ...2007-08-20 18:07:25 · 93 阅读 · 0 评论