reading Rails 3 Release Note (1:Upgrading to 7:Action Pack)

routing 重要。
色々萌える。escaping by default はやっとか!って感じだけど。


sources

more infos

Intro
  • RESTful declaration router
  • AR chainable query lang built on top of relational algebra
  • unobtrusive js driver for jQ and more coming
  • Bundler
Upgrading to Rails 3
Creating Rails 3 app
Architectural Change
Internationalization
Railties
  • each app now has its own namespace
  • anything under Rails.root/app is now added to the load path
    • you can make app/observers/user_observer.rb
  • Rails.config, Rails wide configuration option
  • generators
    • allow you to override the templates by placing a copy at RAILS_ROOT/lib/templates
  • rake
    • rake routes CONTROLLER=x show the routes for one controller
  • deprecated
Action Pack

Action Controller

Action View

  • escaping by default
    • no longer need to call h(string)
    • use raw(string) to unescape
  • helpers now output HTML 5 by default
  • form label helper now pulls values from i18n
    • select label on should now be :en.helpers.select
  • no longer need to place '-' sign on ERb
  • added as new
    • grouped_collection_select helper
    • content_for? allowing you to check before rendering
Action Pack / Action Dispatch
# former
ActionController::Routing::Routes.draw do |map|
  map.resources :posts
end

# now
AppName::Application.routes do
  resources :posts
end

# and scope
#  below gives you the edit action with /es/projeto/1/cambiar
scope 'es' do
  resources :projects, :path_names => { :edit => ''cambiar' }, :as => 'projeto' 
end

# you can pass optional segments
#  each parenthesize segment is optional
'/:controller(/:action(/:id))(.:format)

# routes can be expressed via block
controller :home {
  match '/:action'
}