rails 3.1 sneak peak

16
What's new in Rails 3.1 [email protected]

Upload: oleg-kossoy

Post on 11-May-2015

979 views

Category:

Technology


0 download

DESCRIPTION

Sneak peak of Rails 3.1 new features

TRANSCRIPT

Page 1: Rails 3.1 sneak peak

What's new in Rails 3.1

[email protected]

Page 2: Rails 3.1 sneak peak

Currently RC4, to be released soon

Aaron Patterson

Core team, in rc4 infoRails 3.1.0.rc4 has been released!

Page 3: Rails 3.1 sneak peak

In a nutshell

• Asset Pipeline• HTTP streaming• JQuery by default• Reversible migrations• Mountable engines• Prepared statements

Page 4: Rails 3.1 sneak peak

In a nutshell

• Rack::Cache on by default• Turn test-output on Ruby 1.9• Force SSL• Role-based mass-assignment

protection• BCrypt-based passwords• Custom serializers

There's always changelog

Page 5: Rails 3.1 sneak peak

Assets pipeline

• Powered by Sprockets 2.0

Why use Sprockets?

1. Extract reusable code and share it across multiple web sites or applications. 

2. Speed up your site by automatically concatenating JavaScript into a single file for production. 

3. Organize your JavaScript source code into multiple commented files and directories.

4. Use bleeding-edge framework and library code in your application. 

5. Sprockets is compatible with the PDoc JavaScript documentation system and the JavaScript framework of your choice.

Page 6: Rails 3.1 sneak peak

Assets pipeline

• Enables proper organization, including use in plugins and engines

Page 7: Rails 3.1 sneak peak

Assets pipeline

Js plugin example

plugins/color_picker/assets/images/color_picker/arrow.pngplugins/color_picker/assets/images/color_picker/circle.pngplugins/color_picker/assets/images/color_picker/hue.pngplugins/color_picker/assets/images/color_picker/saturation_and_brightness.pngplugins/color_picker/assets/stylesheets/color_picker.cssplugins/color_picker/src/color.jsplugins/color_picker/src/color_picker.js

color_picker.js:

//= require "color"//= provide "../assets"

When <color_picker> is required in your application, its provide directive will tell Sprockets that all files in the plugins/color_picker/assets/ directory should be copied into the web server's document root.

Page 8: Rails 3.1 sneak peak

Assets pipeline

Compiling to one application.js//= require jquery//= require jquery_ujs//= require_tree .//= require 'independent_file'//= require 'super_lib'

Page 9: Rails 3.1 sneak peak

Assets pipeline

“CoffeeScript is well done and more convenient to use

than JavaScript”- Brendan Eich, inventor of JavaScript

Page 10: Rails 3.1 sneak peak

Assets pipeline

CoffeeScript

• Ruby-like syntax• Doesn't deprecate JavaScript code• OOP made easy (extends, etc)• Arrays with slicing and generators• Strings with interpolation and multi-line

Page 11: Rails 3.1 sneak peak

Assets pipeline

CoffeeScript

Page 12: Rails 3.1 sneak peak

Assets pipeline

CoffeeScript

http://asciicasts.com/episodes/267-coffeescript-basics

Page 13: Rails 3.1 sneak peak

Assets pipeline

SASS

• Nesting• Variables• Mixins

Page 14: Rails 3.1 sneak peak

Reversible migrations

 

Page 15: Rails 3.1 sneak peak

Basic Auth

Page 16: Rails 3.1 sneak peak