activerecord-deprecated_finders • Mass assignment protection in Active Record models rails/protected_attributes • ActiveRecord::SessionStore rails/activerecord-session_store • Active Record Observers rails/rails-observers • Active Resource rails/activeresource • Action Caching rails/actionpack-action_caching • Page Caching rails/actionpack-page_caching • Sprockets rails/sprockets-rails 3
Rails 4.0.0 • new features • new deprecation warnings • nothing is removed • easy upgrade • Rails 4.0.x • no new features • no new deprecation warnings • Rails 4.1: • new features • removes deprecated stuff 6
:girl #, :good end # app/controllers/kids_controller.rb class KidsController < ApplicationController def create @kid = Kid.new(params[:kid]) if @kid.save redirect_to root_url else render action: "new" end end end 3 Mass-asignment protection 8
@toy_id = attr[:toy_id] end def run kid = Kid.find(@kid_id) toy = Toy.find(@toy_id) # toy.send_to(kid) end end # Then, add an instance of WishSender to Rails.queue. # A likely place for this code is in a controller: class KidsController < ApplicationController def send_toy Rails.queue << ToySender.new(params) flash[:notice] = "Toy queued to be sent!" redirect_to kids_url end end 4 4 17
in the # queue system WelcomeMailer.welcome(@kid).deliver # You should do WelcomeMailer.welcome(@kid.id).deliver # welcome_mailer.rb class WelcomeMailer < ActionMailer::Base def welcome(id) @kid = User.find(id) # prepare your mail end end 4 22
page instance is kept alive • only the body and title of the page are replaced 4 • response contains the full rendered page, so no bandwidth is saved 38
called if loading fresh, not from cache). page:load fetched page is being retrieved fresh from the server page:restore fetched page is being retrieved from the 10-slot client-side cache page:change page has changed to the newly fetched version 41
resources :pictures ! end ! resources :kids do ! ! resources :pictures ! end ! resources :elves do ! ! resources :pictures ! end end Your routes are not DRY 3 55