Rails 3.1 Awesomeness - what's new

Post on 19-May-2015

3,707 views 1 download

Tags:

description

Steven Ringo from Dynamic Clarity and Ryan Bigg from RubyX presents what's new in Rails 3.1 for Ruby on Rails Oceania's Sydney Meet-up for May 2011.

transcript

Rails 3.1 awesomenessfor roro Sydney Meet-up May 2011

Steven Ringosteven@dynamicclarity.com

Ryan Bigg radarlistener@gmail.com

http://www.flickr.com/photos/23611308@N03/4252962768/

massive

see full list athttps://gist.github.com/958283

*thanks to Ryan Bates for the list

jQuery new default

jquery-rails gemprototype-rails gem

Sass (scss) is a first-class citizen

wtf is sass?

see also compass:http://compass-style.org/reference/compass/

asset packaging

CoffeeScript

Compiles to JavaScript

Ruby-like syntactic sugar to enhance JS

Array comprehension and pattern matching

Don’t freak out, its not mandatory

in-memory cache to preventduplicate retrieval of the same object data from the

database

Identity Map

HTTP Streaming

http://en.wikipedia.org/wiki/Manneken_Pis

classic asp had this in 1997: <%response.Buffer=true%>

a.k.a. chunked transfer encoding

send content to the browser before the serveris finished processing

http://weblog.rubyonrails.org/2011/4/18/why-http-streaming

ostensibly faster page loads

ActiveModel::SecurePassword

B

ActiveModel::SecurePassword

BCrypt = brute force resistant

Can be made slower... (Moore’s law)

class User < ActiveRecord::Base has_secure_passwordend

Migration system will figure out how to reverse your migration.

Instance methods, not class methods.

Reversible Migrations Reversible Migrations

class MyMigration < ActiveRecord::Migration def change create_table(:horses) do t.column :content, :text t.column :remind_at, :datetime end endend

Mass assignment with roles

class Post < ActiveRecord::Base attr_accessible :title attr_accessible :title, :published_at, :as => :adminend

Post.new(params[:post], :as => :admin)

Railscasts on 3.1 ep #26510/5/2011