Rails3.0リリースノート超訳

http://weblog.rubyonrails.org/2010/8/29/rails-3-0-it-s-done の超訳です。

Rails3.0の開発が進められてきたこの2年間、最終的にリリースに辿りつくまで我々(開発陣)には膨大なプレッシャがかかっていた。そして1600人以上のcontributorsとともに、あらゆるものを改善し、高速化し、綺麗にし、そして更に美しくしてきた。

第三世代のRailsは数万のコミットからなっており、何が特徴か拾い上げるのはいつでも大変で不可能なことだ。しかしRails3の主要な変更点をあげてみよう。

新しいActiveRecordエンジン

users = User.where(:name => "david").limit(20)
users.where("age > 29")

# SELECT * FROM users
# WHERE name = "david" AND age > 29
# ORDER BY name
# LIMIT 20
users.order(:name).each { |user| puts user.name }

ActionControllerのための新しいroute

resources :people do
  resource :avatar

  collection do
    get :winners, :losers
  end
end

# /sd34fgh/rooms
scope ':token', :token => /\w{5,5}/ do
  resources :rooms
end

# /descriptions
# /pl/descriptions
# /en/descriptions
scope '(:locale)', :locale => /en|pl/ do
  resources :descriptions
  root :to => 'projects#index'
end

新しいActionMailer

class Notifier < ActionMailer::Base
  default :from =>
    "Highrise <system@#{APPLICATION_DOMAIN}>" 

  def new_project(digest, project, person)
    @digest, @project, @person = digest, project, person

    attachments['digest.pdf'] = digest.to_pdf
    attachments['logo.jpg']   = File.read(project.logo_path)

    mail(
      :subject => "Your digest for #{project.name}",
      :to => person.email_address_with_name
    ) do |format|
      format.text { render :text => "Something texty" }
      format.html { render :text => "Something <i>texty</i>" }
    end
  end
end

依存性を管理するBundler

XSS保護をデフォルトに

encodingの不具合にさよならを言おう

ActiveModel:Validation、Callbackなどなどを全てのモデルに

公式のプラグインAPI

内部の書き換え

jQuery,rSpec,DataMapperで”agnosticism”に到達

文書

インストール方法

謝意と次のステップについて

Leave a Reply