What's new in Rails 4.1 - Paul Grayson

B044a0f039af800f4df09bf3b2465f18?s=47 Las Vegas Ruby Group
April 23, 2014
36

What's new in Rails 4.1 - Paul Grayson

B044a0f039af800f4df09bf3b2465f18?s=128

Las Vegas Ruby Group

April 23, 2014
Tweet

Transcript

  1. What's new in Rails 4.1 Paul Grayson Las Vegas Ruby

    User Group 2014-04-23
  2. What's new in Rails 4.1 • 5210 commits (1469 pull

    requests) • 601 authors • Work done 2012-12-09 to 2014-04-08 • v4.0.0.rc1 released 2013-04-29 • v4.0.0 released 2013-06-25 • v4.1.0 released 2014-04-08 git log v4.1.0 --not v4.0.0
  3. Spring application preloader used by default • Keeps a server

    running constantly • Hopefully auto-loads your files
  4. config/secrets.yml • Standard place to keep secrets so they won't

    be checked into git • Not added to .gitignore in 4.1.0 (!) • No support for deploying this file • You probably still need to use ENV
  5. Action Pack Variants • Custom pages intended for different devices

    • Examples are all about USER_AGENT • Not much documentation, but it's simple • Please don't use this!
  6. Action Mailer Previews • Looking at your mailers in a

    browser • Formerly the MailView gem from 37signals http://localhost:3000/rails/mailers
  7. Action Mailer Previews

  8. Active Record enums • NOT native database enums • Stored

    as integers class Conversation < ActiveRecord::Base enum status: [ :active, :archived ] end conversation.active? converstaion.active! Converstaion.active.each { ... }
  9. Message Verifiers • Was previously used only for cookies •

    Now available for unsubscribe links, etc. • Vulnerable to replay attacks, so use sparingly
  10. Module#concerning • Formerly the concerning gem by 37signals • Good

    for cleaning up “junk-drawer classes” class Todo concerning :EventTracking do included do has_many :events end class_methods do def next_by_event # ... end end end end
  11. CSRF protection for .js requests • Protects against some obscure

    attacks • You will need to provide tokens for AJAX
  12. Load structure.sql instead of db:test:prepare • This file should be

    in source control • Ensures that everyone is testing the same DB
  13. Discussion