SlideShare a Scribd company logo
Ce e nou in Rails 4

        Florin Oltean
           Cluj.rb
         2013-04-04
Cuprins

• Rails 4
 • Nou
 • Imbunatatit / schimbat
 • Extras
Rails 4.0 Beta 1
a fost lansat in 2013-02-25
a fost lansat in 2013-02-25
Nou in Rails 4
• Minim Ruby 1.9.3
• Preferat Ruby 2.0
Caching

• Russian Doll Caching
• Declarative ETags
• turbolinks
Securitate

• strong parameters
• default headers
• encrypted cookie
Strong parameters
• Mutare logica din Model in Controller
 • nu ne mai incurca in locuri in care nu
    avem input de la user (consola, teste,
    etc.)
  • avem acces la ‘current_user’
  • white-list
  • posibila problema cand accesam acelasi
    model din mai multe controllere (!DRY)
Strong parameters
Default headers
Encrypted cookie

• inainte era doar semnat cookie-ul
• tot nu ar trebui sa pune date sensibile in
  cookie
  • sa punem o referinta si sa stocam
    server-side
• Suport pentru tipuri de date Postgres
 • hstore
 • array
 • MACADDR, INET, CIDR
• Live Streaming
 • push de la server pe conexiuni
    persistente
 • pe versiunile recente de browsere (mai
    putin IE)
• Metoda HTTP PATCH
 • Inlocuieste metoda PUT
 • Metoda PATCH trebuie folosita atunci
    cand in request nu se trimite resursa
    completa
 • PUT va mai functiona o vreme
• Form helper: date_field

• Chrome



• Safari
• application.rb
 • console do ... end
Schimbat in Rails 4
ActiveRecord

• .all => lazy
 • .scope => deprecated
 • .all.to_a => incarca obiectele din BD
ActiveRecord

• .where.not
 • Author.where.not(age: 21)
 • SELECT "authors".* FROM "authors"
    WHERE ("authors"."age" != 21)
ActiveRecord

• .order(field: :direction)
 • Author.order(name: :desc)
 • SELECT "authors".* FROM "authors"
    ORDER BY "authors"."name" DESC
ActiveRecord

• .find_by(name: "Tom")
 • era .find_by_name("Tom")
• .find_or_create_by(name: "Tom")
 • era .find_or_create_by_name("Tom")
ActiveRecord
• .scope :name, -> { where(...) }
• deprecated:
 • .scope :name, where(...)
ActiveModel::Model
Organizare teste
• public/index.html generata intern
 • nu mai trebuie stearsa din aplicatiile noi
Rute


• match => get, post, ...
• concerns
• thread safe on by default (production)
 • config.eager_load = true
 • ex: http://puma.io/
Development
• pagina de eroare imbunatatita
Development
• /rails/info
Extras din Rails 4
• Page and Action Caching
 • inlocuit cu Russian Doll Caching
• Observers
 • rolul Observerilor era sa fie folositi
    pentru invalidarea cache-ului
• ActiveResource
• SessionStore
Ce nu a intrat in Rails 4


• Background Queueing
• Asynchronous ActionMailer
Referinte
http://railscasts.com/episodes/400-what-s-new-in-rails-4
http://weblog.rubyonrails.org/2013/2/25/Rails-4-0-beta1/
https://blog.engineyard.com/2013/rails-4-changes
https://blog.engineyard.com/2013/new-in-rails-4
Contact



    @florin555
florin555@gmail.com
?

More Related Content

PDF
Firebird Interbase Database engine hacks or rtfm
PPTX
Ansible @ WebElement 2015
PDF
Deploying WO on Windows
KEY
Rails with mongodb
PDF
Доклад Михаила Егорова на PHDays
PDF
Engage 2014 OpenNTF Domino API Slides
PDF
Getting Started with PureScript
PDF
DanNotes 2013: OpenNTF Domino API
Firebird Interbase Database engine hacks or rtfm
Ansible @ WebElement 2015
Deploying WO on Windows
Rails with mongodb
Доклад Михаила Егорова на PHDays
Engage 2014 OpenNTF Domino API Slides
Getting Started with PureScript
DanNotes 2013: OpenNTF Domino API

What's hot (20)

PPTX
Introduction to Ansible - Jan 28 - Austin MeetUp
PDF
Web sec-淺談
PDF
JavaScript Language Update 2016 (LLoT)
PDF
Functional Hostnames and Why they are Bad
PDF
Ansible 101
PPTX
T4T Training day - NodeJS
PDF
Heroku Dockerの使い所
PDF
Xitrum HOWTOs
PDF
Debugging and Testing ES Systems
PDF
Dive into sentry
PDF
Managing sensitive data with Ansible vault
PPT
Ansible presentation
KEY
Sentry (SF Python, Feb)
PPTX
Tampering with JavaScript
PPT
JavaScript Testing: Mocha + Chai
PDF
Data Processing and Ruby in the World
PDF
Dexador Rises
PDF
Jenkins and ansible reference
PDF
Ansible Introduction - Ansible Brno #1 - David Karban
Introduction to Ansible - Jan 28 - Austin MeetUp
Web sec-淺談
JavaScript Language Update 2016 (LLoT)
Functional Hostnames and Why they are Bad
Ansible 101
T4T Training day - NodeJS
Heroku Dockerの使い所
Xitrum HOWTOs
Debugging and Testing ES Systems
Dive into sentry
Managing sensitive data with Ansible vault
Ansible presentation
Sentry (SF Python, Feb)
Tampering with JavaScript
JavaScript Testing: Mocha + Chai
Data Processing and Ruby in the World
Dexador Rises
Jenkins and ansible reference
Ansible Introduction - Ansible Brno #1 - David Karban
Ad

Similar to Ce e nou in Rails 4 (20)

KEY
KeyValue Stores
KEY
Impression of Rails 3
PDF
ITB2017 - Slaying the ORM dragons with cborm
PDF
ORM Pink Unicorns
PDF
Ruby and Distributed Storage Systems
PDF
ekb.py: KISS REST API
PDF
Killing Shark-Riding Dinosaurs with ORM
PDF
Burp suite
PDF
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
PPT
Node and Azure
PDF
RSpec on Rails Tutorial
PDF
SolrCloud on Hadoop
PDF
Middleware in Golang: InVision's Rye
PPTX
In-browser storage and me
PDF
Hacking Adobe Experience Manager sites
KEY
WTF TDD?
PPTX
Service stack all the things
PDF
Not Just ORM: Powerful Hibernate ORM Features and Capabilities
PDF
Stardog 1.1: Easier, Smarter, Faster RDF Database
PDF
Stardog 1.1: An Easier, Smarter, Faster RDF Database
KeyValue Stores
Impression of Rails 3
ITB2017 - Slaying the ORM dragons with cborm
ORM Pink Unicorns
Ruby and Distributed Storage Systems
ekb.py: KISS REST API
Killing Shark-Riding Dinosaurs with ORM
Burp suite
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
Node and Azure
RSpec on Rails Tutorial
SolrCloud on Hadoop
Middleware in Golang: InVision's Rye
In-browser storage and me
Hacking Adobe Experience Manager sites
WTF TDD?
Service stack all the things
Not Just ORM: Powerful Hibernate ORM Features and Capabilities
Stardog 1.1: Easier, Smarter, Faster RDF Database
Stardog 1.1: An Easier, Smarter, Faster RDF Database
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
PDF
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Big Data Technologies - Introduction.pptx
Network Security Unit 5.pdf for BCA BBA.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Chapter 3 Spatial Domain Image Processing.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
sap open course for s4hana steps from ECC to s4
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25 Week I
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Understanding_Digital_Forensics_Presentation.pptx
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation

Ce e nou in Rails 4