SlideShare a Scribd company logo
amsterdam.rb
Rails 5
What's new?
Rails 5 by Jeroen Visser 1
amsterdam.rb
I'm Jeroen Visser
• CTO @ Uberous
• github.com/jeroenvisser101
• twiFer.com/jeroenvisser101
• I blog at jrnv.nl
2
That's me
Photo by Tim Gouw
amsterdam.rb
I like beta soHware
3
amsterdam.rb
Rails 5
4
amsterdam.rb
Current state
5
Race condiJon →
amsterdam.rb
Current state
6
amsterdam.rb
New in Rails 5
7
amsterdam.rb
Visual idenJty
8
amsterdam.rb
New home page
hFps://github.com/rails/rails/pull/23237
by @gsamokovarov
9
amsterdam.rb 10
amsterdam.rb 11
amsterdam.rb
AcJon Cable
12
amsterdam.rb
What is AcJon Cable?
13
amsterdam.rb
Live
14
amsterdam.rb
How does it work?
15
amsterdam.rb
How does it work?
Channel
Imagine this as an IRC channel
Users can subscribe to it
16
Broadcast
Imagine this as a message sent
on a channel
amsterdam.rb 17
class NotificationChannel < ApplicationCable::Channel







end
def subscribed

stream_from "some_channel"

end
def unsubscribed

# Any cleanup needed when channel is unsubscribed

end
amsterdam.rb 18
ActionCable.server.broadcast(

"some_channel",

some_data: "some string"

)
amsterdam.rb 19
def subscribed

stream_for current_user

end
amsterdam.rb
NotificationChannel.broadcast_to(

@user,

@notification

)
amsterdam.rb
MulJplexing
21
image from wikimedia
amsterdam.rb
Front-end setup
22
amsterdam.rb 23
# app/assets/javascripts/cable.coffee



#= require_self



@App ||= {}

App.cable = ActionCable.createConsumer()
#= require action_cable
#= require_tree ./channels
amsterdam.rb 24
# .../javascripts/channels/notification_channel.coffee
App.cable.subscriptions.create {

channel: 'some_channel'

any_other_parameters: 'some value'

}, received: (data) ->

console.log data
amsterdam.rb
ActionController::Renderer
25
amsterdam.rb 26
MessagesController.render(

partial: 'messages/message',

locals: { message: params[:message][:body] }

)
amsterdam.rb
Rails API
27
amsterdam.rb 28
rails new my-api-project --api
amsterdam.rb
AFributes API
29
amsterdam.rb 30
# app/models/product.rb

class Product < ApplicationRecord

attribute :price_in_cents, MoneyType.new

end
amsterdam.rb 31
class MoneyType < ActiveRecord::Type::Integer

def type_cast(value)

# convert values like '$10.00' to 1000

end

end
amsterdam.rb 32
product = Product.new(price_in_cents: '$10.00')

product.price_in_cents #=> 1000
amsterdam.rb
ApplicaJonRecord
33
amsterdam.rb 34
class ApplicationRecord < ActiveRecord::Base



end
self.abstract_class = true
amsterdam.rb
ActiveRecord::Relation#or
35
amsterdam.rb 36
Project.flagged.or(Project.open)

# or

Project.where(name: "My Project").

or(Project.where(name: "Other Project"))
amsterdam.rb
ActiveRecord::Relation#in_batches
37
amsterdam.rb 38
Person.where("age >= 18").in_batches(of: 10) do |people|

people.update_all(can_drink: true)

end
amsterdam.rb
ActiveRecord::Base#has_secure_token
39
amsterdam.rb 40
class User < ApplicationRecord

has_secure_token :email_verification_token

end
amsterdam.rb 41
user = User.create

user.email_verification_token
#=> 'e2426a93718d1817a43abbaa'
amsterdam.rb 42
user.regenerate_email_verification_token
amsterdam.rb
rake db:migrate
43
amsterdam.rb
rails db:migrate
44
rake db:migrate
amsterdam.rb
Turbolinks 3
45
amsterdam.rb
Turbolinks 5
46
Turbolinks 3
amsterdam.rb
Upgrading to Rails 5
47
amsterdam.rb
> Ruby 2.2.2
48
amsterdam.rb
Write tests
49
amsterdam.rb
Write good tests
50
Write tests
amsterdam.rb
rails app:update
51
amsterdam.rb
Thanks!
uberous.io / jrnv.nl
52

More Related Content

KEY
Why I Love TorqueBox (And Why You Will Too)
PDF
Axon Server went RAFTing
PDF
Infinum Android Talks #05 - Square tape
PDF
AWS Lambda Function with Kotlin
PDF
How we migrated Zalando app to Swift3?
PDF
Reasonable app development
PDF
Brief introduction to Angular 2.0 & 4.0
PDF
Contribute to rails
Why I Love TorqueBox (And Why You Will Too)
Axon Server went RAFTing
Infinum Android Talks #05 - Square tape
AWS Lambda Function with Kotlin
How we migrated Zalando app to Swift3?
Reasonable app development
Brief introduction to Angular 2.0 & 4.0
Contribute to rails

What's hot (20)

PDF
Building Services on and off Rails
PPT
Conejo Architecture
PDF
Otto MVP Presentation
PDF
Mongrel Handlers
PDF
Riak at Posterous
PDF
Python to go
PPTX
Aop With Post Sharp
PPTX
RESTful API Testing using Postman, Newman, and Jenkins
PPT
Stuff we noticed while building "Asterisk in the cloud"
PDF
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
PDF
20161020 GeeCON Continuous delivery
PDF
Technology | Serverless
PPTX
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
PPTX
4 step-users-guide-wp-local-installation-15-10-02
DOC
Qtp quiz for you
PDF
Hacking Real time Messaging with Firebase
PDF
Manchester Expert Talks (April 2017) - Breaking Down Your Build: Architectura...
PPT
Custom Mongrel Handlers: Learning how to walk the dog
PPTX
Exactly Once Delivery - Natan Silnitsky
KEY
CPAN Realtime feed
Building Services on and off Rails
Conejo Architecture
Otto MVP Presentation
Mongrel Handlers
Riak at Posterous
Python to go
Aop With Post Sharp
RESTful API Testing using Postman, Newman, and Jenkins
Stuff we noticed while building "Asterisk in the cloud"
GitLab Commit 2020: Ubiquitous quality through continuous testing pipelines
20161020 GeeCON Continuous delivery
Technology | Serverless
C# Async on iOS and Android - Miguel de Icaza, CTO of Xamarin
4 step-users-guide-wp-local-installation-15-10-02
Qtp quiz for you
Hacking Real time Messaging with Firebase
Manchester Expert Talks (April 2017) - Breaking Down Your Build: Architectura...
Custom Mongrel Handlers: Learning how to walk the dog
Exactly Once Delivery - Natan Silnitsky
CPAN Realtime feed
Ad

Viewers also liked (13)

DOC
Goutam das cv_2016_
PPTX
PPTX
Stop testing start designing
PPTX
Good manners (1)
PDF
Baseball/softball: Thursday scores
PDF
PPT
國民黨黨產報告
PDF
SFG - White Paper - Regional Talent Management
PDF
DFS對兆豐銀的裁罰同意書
PPTX
Incremental and iterative stratergy
PPT
Innovacion Empresarial
PDF
Investiguem el mar (respostes fitxes 2a)
PDF
RPhG Corp Presentation_June 3 2016_kr
Goutam das cv_2016_
Stop testing start designing
Good manners (1)
Baseball/softball: Thursday scores
國民黨黨產報告
SFG - White Paper - Regional Talent Management
DFS對兆豐銀的裁罰同意書
Incremental and iterative stratergy
Innovacion Empresarial
Investiguem el mar (respostes fitxes 2a)
RPhG Corp Presentation_June 3 2016_kr
Ad

Similar to Rails 5 – Amsterdam.rb – Uberous (20)

PDF
猿でもわかる Helm
PDF
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
PDF
It's a Jungle Out There – IoT and MRuby
PPTX
Silverlight vs HTML5 - Lessons learned from the real world...
ZIP
Mojolicious
PDF
The Ruby workflow
PDF
WebAssemlby vs JavaScript
PDF
PWL: One VM to Rule Them All
PDF
Why we use mruby with Perl5?
KEY
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
KEY
Continuous Integration, the minimum viable product
PDF
Web, Native iOS and Native Android with One Ember.js App
PPT
Pre-rendering single page app
PDF
DevOps with Serverless
PPTX
Web Unleashed Toronto 2015: Hybrid Mobile Apps with Ember.js
PDF
Breaking Bad Habits with GitLab CI
PPTX
Building reliable applications with React, C#, and Azure
PDF
presentation
PDF
Ruby Performance - The Last Mile - RubyConf India 2016
PDF
Kernel load-balancing for Docker containers using IPVS
猿でもわかる Helm
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
It's a Jungle Out There – IoT and MRuby
Silverlight vs HTML5 - Lessons learned from the real world...
Mojolicious
The Ruby workflow
WebAssemlby vs JavaScript
PWL: One VM to Rule Them All
Why we use mruby with Perl5?
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
Continuous Integration, the minimum viable product
Web, Native iOS and Native Android with One Ember.js App
Pre-rendering single page app
DevOps with Serverless
Web Unleashed Toronto 2015: Hybrid Mobile Apps with Ember.js
Breaking Bad Habits with GitLab CI
Building reliable applications with React, C#, and Azure
presentation
Ruby Performance - The Last Mile - RubyConf India 2016
Kernel load-balancing for Docker containers using IPVS

Recently uploaded (20)

PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
assetexplorer- product-overview - presentation
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
Cybersecurity: Protecting the Digital World
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
STL Containers in C++ : Sequence Container : Vector
PDF
iTop VPN Crack Latest Version Full Key 2025
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Weekly report ppt - harsh dattuprasad patel.pptx
Time Tracking Features That Teams and Organizations Actually Need
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
How to Use SharePoint as an ISO-Compliant Document Management System
Why Generative AI is the Future of Content, Code & Creativity?
Salesforce Agentforce AI Implementation.pdf
assetexplorer- product-overview - presentation
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Cybersecurity: Protecting the Digital World
Tech Workshop Escape Room Tech Workshop
DNT Brochure 2025 – ISV Solutions @ D365
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
GSA Content Generator Crack (2025 Latest)
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Computer Software and OS of computer science of grade 11.pptx
STL Containers in C++ : Sequence Container : Vector
iTop VPN Crack Latest Version Full Key 2025

Rails 5 – Amsterdam.rb – Uberous