SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
RAILS 5
SRUG 28.01.2015
Jan Berdajs
@mrbrdo
RELEASE DATE
• Rails 5.0.0.beta1 was released 18. December 2015
• We don’t know when the final version will come
• Rails 4.0.0.beta1 - 26. February 2013
• Rails 4.0.0.rc1- 1. May 2013 (2 months after beta1)
• Rails 4.0.0 Final - 25. June 2013 (4 months after beta1)
RUBY 2.2.2 OR HIGHER
• Symbol garbage collector (no more Symbol DDoS,
no more being extra careful)
• Incremental GC
• Module#prepend
• Keyword arguments
UPDATES
• Bugfixes only for Rails 4.2.x and 5.x
• Rails 4.1.x and lower will not be supported
anymore
DEPRECATED CODE
REMOVED
• ActionMailer
• deliver removed - use deliver_now or deliver_later
• *_path url helpers removed - use *_url
DEPRECATED CODE
REMOVED
• ActiveRecord
• protected_attributes completely unsupported
now (the old attr_accessible)
• activerecord-deprecated_finders completely
unsupported, but who was still using that anyway
(find(:all, conditions: { … }))
DEPRECATED CODE
REMOVED
• ActionPack
• some test helpers for testing controllers were
moved into a gem rails-controller-testing
• assert_template
• assigns
AND STUFF
• template.html is no longer parsed by ERB (must
have .erb extension)
BORING CHANGES
That most of us won’t care about
RAILS COMMAND
• You can now call rake tasks via the rails command
• e.g. rails db:migrate
• Who cares
• Maybe easier for big noobs
• Don’t like too much
TURBOLINKS 2
Good news:
Rails 5 will not includeTurbolinks 2!
TURBOLINKS 5
Bad news:
Rails 5 will includeTurbolinks 5.
TURBOLINKS
• If you are already using Rails 5 (master), you might
still be usingTurbolinks 2
TURBOLINKS 5
• It has native iOS and Android wrapper implementations. Supposedly so
if you use a WebView in a native app you can useTurbolinks.
• So basically useful for hybrid native apps.
• It also implements partial updates and uses some HTML5 (data-*)
attributes to make things easier.
• Who cares? Probably only Basecamp.
• I don’t know why this is part of Rails.

Probably because Basecamp.
MINITEST RUNNER
• Basically add a bunch of features to minitest runner command, that rspec already has
since like forever.
• Run a single test file, or specify line. Had for years in rspec.
• Run multiple test files. Had for years in rspec.
• Color output. Had for years in rspec.
• Fail fast. Had for years in rspec.
• Etc…
• Do I care? No… At least Rails core development will be easier. But they could just
switch to rspec.
MYSQL
• Added support for JSON datatype.

MYSQL
• Added support for JSON datatype.

HAS_SECURE_TOKEN
• good idea but not that great implementation (unreliable)
• it uses SecureRandom with Base58 to generate a 24-char token.
class Invite < ActiveRecord::Base
has_secure_token :invitation_code
end
invite = Invite.new
invite.save
invite.invitation_code # => 44539a6a59835a4ee9d7b112
invite.regenerate_invitation_code # => true
MORE EXCITING CHANGES
That I would say are cool
BETTER PERFORMANCE
• Lots of work done here, e.g. freezing strings
• Development mode now uses evented FS
monitor, which is much faster than checking all files
if they were updated, as it worked in Rails 4
RAILS-API
• rails new name --api
• active_model_serializers
• more or less works just like rails-api worked
• it’s nice that the core rails team will be working on
this
ACTIONCABLE
• It’s basically like Heroku pusher - websockets, push server…
• Uses parts of faye-websocket and concurrent-ruby
(threading lib)
• Similar to faye, you subscribe to channels and then receive
events in JS when new messages arrive.
• It might not sound that useful but it actually has a lot of use
cases
ACTIONCONTROLLER::RENDERER
• Refactor of ActionController
• It makes it much easier to render templates outside of controllers
(useful in delayed jobs and for ActionCable)
• ApplicationController.render ‘sample/index'
• ApplicationController.render assigns: { rails: 'Rails' }, inline: '<%= "Hello
#{@rails}" %>’
• Makes this much easier when you need it. Before we had to do crazy
stuff with AbstractController::Base
ACTIVERECORD ATTRIBUTES
• Basically allows you to define coercion rules for attributes.
• It also works for virtual attributes.
• It’s not that big of a deal, we could just define a getter and
setter method to achieve the same thing.
• But it is nice and may play with the framework better
than just defining attribute accessor methods.
ACTIVERECORD ATTRIBUTES
class Book < ActiveRecord::Base
end
book.quantity # => 12.0
class Book < ActiveRecord::Base
attribute :quantity, :integer
end
book.quantity # => 12
class Product < ApplicationRecord
attribute :price_in_cents, MoneyType.new
end
class MoneyType < ActiveRecord::Type::Integer
def type_cast(value)
# convert values like '$10.00' to 1000
end
end
product = Product.new(price_in_cents: '$10.00')
product.price_in_cents #=> 1000
APPLICATIONRECORD
• Now controllers inherit from ApplicationRecord
instead of ActiveRecord::Base
• Basically just so ActiveRecord::Base monkey-
patching won’t have to be done, instead you do
that in ApplicationRecord now, so if some gems
use ActiveRecord::Base they won’t be affected by
the monkey-patches.
ACTIVERECORD OR
• Finally we can use “or” in ActiveRecord
• Unfortunately the API is a bit stupid imo
• I prefer how it’s done in Sequel
Book.where('status = 1').or(Book.where('status = 3'))
Book.where(Sequel.or(status: 1, name: "Book"))
Book.where { |t| { t.status => 1 } | { t.name => "Book" } }
ACTIVERECORD IN_BATCHES
Person.where('age >= 18').in_batches(of: 1000) do |people|
people.update_all(can_vote: true)
end
BELONGS_TOVALIDATION
• By default, when you have a belongs_to
association you will automatically get a presence
validation for it
• You can explicitly make it optional:
class Book < ActiveRecord::Base
belongs_to :author, optional: true
end
ACTIVERECORD HOOKS
• Until Rails 4, if you return false from a before_*
hook, it would halt the whole operation (e.g. save)
• In Rails 5, this is no longer the case.
• You now have to use
• Oh my godTHANKYOU
throw(:abort)
CONCLUSION
• There are some new things, and not a lot of changes to existing APIs, so
upgrading shouldn’t be too hard.Also use rails rails:update.
• The belongs_to validation is one of the things you’ll have to be careful
about.
• We have better tools to create API projects, and if you’re not doing an API
project, you have some newTurbolinks features to make everything
snappier.
• Similar release to Rails 4, there are not many breaking changes, and it’s a
good thing. No need to fix something that’s not broken.
THANKS

Contenu connexe

Tendances

Taming monolithic monsters
Taming monolithic monstersTaming monolithic monsters
Taming monolithic monstersgavinjoyce
 
Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...
Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...
Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...LogeekNightUkraine
 
Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0Nisheed Jagadish
 
How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...
How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...
How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...UK DevOps Collective
 
Cassandra Summit 2014: Astyanax — To Be or Not To Be
Cassandra Summit 2014: Astyanax — To Be or Not To BeCassandra Summit 2014: Astyanax — To Be or Not To Be
Cassandra Summit 2014: Astyanax — To Be or Not To BeDataStax Academy
 
Java to scala
Java to scalaJava to scala
Java to scalaGiltTech
 
Run Code, Not Servers: AWS Lambda
Run Code, Not Servers: AWS LambdaRun Code, Not Servers: AWS Lambda
Run Code, Not Servers: AWS LambdaÖzgür Çiçek
 
Scaling LoL Chat to 70M Players
Scaling LoL Chat to 70M PlayersScaling LoL Chat to 70M Players
Scaling LoL Chat to 70M PlayersMichał Ptaszek
 
簡単にレビュー環境が作れる仕組みを作ってる話し
簡単にレビュー環境が作れる仕組みを作ってる話し簡単にレビュー環境が作れる仕組みを作ってる話し
簡単にレビュー環境が作れる仕組みを作ってる話し正貴 小川
 
E2E Data Pipeline - Apache Spark/Airflow/Livy
E2E Data Pipeline - Apache Spark/Airflow/LivyE2E Data Pipeline - Apache Spark/Airflow/Livy
E2E Data Pipeline - Apache Spark/Airflow/LivyRikin Tanna
 
Large web applications development
Large web applications developmentLarge web applications development
Large web applications developmentTaras Omelianenko
 
Микросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring CloudМикросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring CloudVitebsk DSC
 
Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...
Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...
Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...gethue
 
NAB Tech Talk
NAB Tech TalkNAB Tech Talk
NAB Tech Talkconfluent
 
Phoenix for Rubyists
Phoenix for RubyistsPhoenix for Rubyists
Phoenix for RubyistsDoug Goldie
 
Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016Mike North
 
Avoiding integration hell
Avoiding integration hellAvoiding integration hell
Avoiding integration hellaaronbassett
 
Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!Fabian Hueske
 

Tendances (20)

Taming monolithic monsters
Taming monolithic monstersTaming monolithic monsters
Taming monolithic monsters
 
Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...
Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...
Gasimov Orkhan "Service Discovery and Coordination by Netflix Eureka and Spri...
 
Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0Brief introduction to Angular 2.0 & 4.0
Brief introduction to Angular 2.0 & 4.0
 
How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...
How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...
How and why test Azure Front Door with AWS Lambda & PowerShell? | Osman Sahin...
 
Cassandra Summit 2014: Astyanax — To Be or Not To Be
Cassandra Summit 2014: Astyanax — To Be or Not To BeCassandra Summit 2014: Astyanax — To Be or Not To Be
Cassandra Summit 2014: Astyanax — To Be or Not To Be
 
Java to scala
Java to scalaJava to scala
Java to scala
 
Run Code, Not Servers: AWS Lambda
Run Code, Not Servers: AWS LambdaRun Code, Not Servers: AWS Lambda
Run Code, Not Servers: AWS Lambda
 
Scaling LoL Chat to 70M Players
Scaling LoL Chat to 70M PlayersScaling LoL Chat to 70M Players
Scaling LoL Chat to 70M Players
 
簡単にレビュー環境が作れる仕組みを作ってる話し
簡単にレビュー環境が作れる仕組みを作ってる話し簡単にレビュー環境が作れる仕組みを作ってる話し
簡単にレビュー環境が作れる仕組みを作ってる話し
 
E2E Data Pipeline - Apache Spark/Airflow/Livy
E2E Data Pipeline - Apache Spark/Airflow/LivyE2E Data Pipeline - Apache Spark/Airflow/Livy
E2E Data Pipeline - Apache Spark/Airflow/Livy
 
JakartaJS: Serverless in production
JakartaJS: Serverless in productionJakartaJS: Serverless in production
JakartaJS: Serverless in production
 
Large web applications development
Large web applications developmentLarge web applications development
Large web applications development
 
Микросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring CloudМикросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring Cloud
 
Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...
Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...
Spark Summit Europe: Building a REST Job Server for interactive Spark as a se...
 
NAB Tech Talk
NAB Tech TalkNAB Tech Talk
NAB Tech Talk
 
LWP + libcurl
LWP + libcurlLWP + libcurl
LWP + libcurl
 
Phoenix for Rubyists
Phoenix for RubyistsPhoenix for Rubyists
Phoenix for Rubyists
 
Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016
 
Avoiding integration hell
Avoiding integration hellAvoiding integration hell
Avoiding integration hell
 
Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!Apache Flink - Akka for the Win!
Apache Flink - Akka for the Win!
 

En vedette

Ruby on Rails 5: Top 5 Features
Ruby on Rails 5: Top 5 FeaturesRuby on Rails 5: Top 5 Features
Ruby on Rails 5: Top 5 FeaturesPhraseApp
 
Virtual reality
Virtual realityVirtual reality
Virtual realityAmit Sinha
 
Hack Programming Language
Hack Programming LanguageHack Programming Language
Hack Programming LanguageRadu Murzea
 
LinkedIn Learning | What We're Learning About Learning
LinkedIn Learning | What We're Learning About LearningLinkedIn Learning | What We're Learning About Learning
LinkedIn Learning | What We're Learning About LearningLinkedIn Learning Solutions
 
Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010Matt Raible
 

En vedette (8)

Ruby on Rails 5: Top 5 Features
Ruby on Rails 5: Top 5 FeaturesRuby on Rails 5: Top 5 Features
Ruby on Rails 5: Top 5 Features
 
Virtual reality
Virtual realityVirtual reality
Virtual reality
 
Hack Programming Language
Hack Programming LanguageHack Programming Language
Hack Programming Language
 
Ruby on Rails for beginners
Ruby on Rails for beginnersRuby on Rails for beginners
Ruby on Rails for beginners
 
LinkedIn Learning | What We're Learning About Learning
LinkedIn Learning | What We're Learning About LearningLinkedIn Learning | What We're Learning About Learning
LinkedIn Learning | What We're Learning About Learning
 
Virtual Reality
Virtual RealityVirtual Reality
Virtual Reality
 
Virtual Reality
Virtual RealityVirtual Reality
Virtual Reality
 
Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010Comparing JVM Web Frameworks - Devoxx 2010
Comparing JVM Web Frameworks - Devoxx 2010
 

Similaire à Rails 5 subjective overview

Herding a Cat with Antlers - Catalyst 5.80
Herding a Cat with Antlers - Catalyst 5.80Herding a Cat with Antlers - Catalyst 5.80
Herding a Cat with Antlers - Catalyst 5.80Tomas Doran
 
Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Sam Muhanguzi
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009pratiknaik
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails_zaMmer_
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails_zaMmer_
 
Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018David Stockton
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage ServerLin Jen-Shin
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesHiroshi SHIBATA
 
Walkthrough Neo4j 1.9 & 2.0
Walkthrough Neo4j 1.9 & 2.0Walkthrough Neo4j 1.9 & 2.0
Walkthrough Neo4j 1.9 & 2.0Neo4j
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friendFilip Bruun Bech-Larsen
 
Features, Exportables & You
Features, Exportables & YouFeatures, Exportables & You
Features, Exportables & Youjskulski
 
SharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSébastien Levert
 
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsWriting Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsTim Cinel
 
PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...
PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...
PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...Puppet
 
Five Years of EC2 Distilled
Five Years of EC2 DistilledFive Years of EC2 Distilled
Five Years of EC2 DistilledGrig Gheorghiu
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaKazuhiro Sera
 

Similaire à Rails 5 subjective overview (20)

Rails 3.1
Rails 3.1Rails 3.1
Rails 3.1
 
Herding a Cat with Antlers - Catalyst 5.80
Herding a Cat with Antlers - Catalyst 5.80Herding a Cat with Antlers - Catalyst 5.80
Herding a Cat with Antlers - Catalyst 5.80
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Dev-Friendly Ops
Dev-Friendly OpsDev-Friendly Ops
Dev-Friendly Ops
 
Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Gwt and rpc use 2007 1
Gwt and rpc use 2007 1
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 
Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018Kubernetes Manchester - 6th December 2018
Kubernetes Manchester - 6th December 2018
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage Server
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 
Walkthrough Neo4j 1.9 & 2.0
Walkthrough Neo4j 1.9 & 2.0Walkthrough Neo4j 1.9 & 2.0
Walkthrough Neo4j 1.9 & 2.0
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
 
Features, Exportables & You
Features, Exportables & YouFeatures, Exportables & You
Features, Exportables & You
 
SharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure Functions
 
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsWriting Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
 
PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...
PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...
PuppetConf 2016: Writing Custom Types to Manage Web-Based Applications – Tim ...
 
Five Years of EC2 Distilled
Five Years of EC2 DistilledFive Years of EC2 Distilled
Five Years of EC2 Distilled
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 

Dernier

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 

Dernier (20)

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 

Rails 5 subjective overview

  • 1. RAILS 5 SRUG 28.01.2015 Jan Berdajs @mrbrdo
  • 2. RELEASE DATE • Rails 5.0.0.beta1 was released 18. December 2015 • We don’t know when the final version will come • Rails 4.0.0.beta1 - 26. February 2013 • Rails 4.0.0.rc1- 1. May 2013 (2 months after beta1) • Rails 4.0.0 Final - 25. June 2013 (4 months after beta1)
  • 3. RUBY 2.2.2 OR HIGHER • Symbol garbage collector (no more Symbol DDoS, no more being extra careful) • Incremental GC • Module#prepend • Keyword arguments
  • 4. UPDATES • Bugfixes only for Rails 4.2.x and 5.x • Rails 4.1.x and lower will not be supported anymore
  • 5. DEPRECATED CODE REMOVED • ActionMailer • deliver removed - use deliver_now or deliver_later • *_path url helpers removed - use *_url
  • 6. DEPRECATED CODE REMOVED • ActiveRecord • protected_attributes completely unsupported now (the old attr_accessible) • activerecord-deprecated_finders completely unsupported, but who was still using that anyway (find(:all, conditions: { … }))
  • 7. DEPRECATED CODE REMOVED • ActionPack • some test helpers for testing controllers were moved into a gem rails-controller-testing • assert_template • assigns
  • 8. AND STUFF • template.html is no longer parsed by ERB (must have .erb extension)
  • 9. BORING CHANGES That most of us won’t care about
  • 10. RAILS COMMAND • You can now call rake tasks via the rails command • e.g. rails db:migrate • Who cares • Maybe easier for big noobs • Don’t like too much
  • 11. TURBOLINKS 2 Good news: Rails 5 will not includeTurbolinks 2!
  • 12. TURBOLINKS 5 Bad news: Rails 5 will includeTurbolinks 5.
  • 13. TURBOLINKS • If you are already using Rails 5 (master), you might still be usingTurbolinks 2
  • 14. TURBOLINKS 5 • It has native iOS and Android wrapper implementations. Supposedly so if you use a WebView in a native app you can useTurbolinks. • So basically useful for hybrid native apps. • It also implements partial updates and uses some HTML5 (data-*) attributes to make things easier. • Who cares? Probably only Basecamp. • I don’t know why this is part of Rails.
 Probably because Basecamp.
  • 15. MINITEST RUNNER • Basically add a bunch of features to minitest runner command, that rspec already has since like forever. • Run a single test file, or specify line. Had for years in rspec. • Run multiple test files. Had for years in rspec. • Color output. Had for years in rspec. • Fail fast. Had for years in rspec. • Etc… • Do I care? No… At least Rails core development will be easier. But they could just switch to rspec.
  • 16. MYSQL • Added support for JSON datatype.

  • 17. MYSQL • Added support for JSON datatype.

  • 18. HAS_SECURE_TOKEN • good idea but not that great implementation (unreliable) • it uses SecureRandom with Base58 to generate a 24-char token. class Invite < ActiveRecord::Base has_secure_token :invitation_code end invite = Invite.new invite.save invite.invitation_code # => 44539a6a59835a4ee9d7b112 invite.regenerate_invitation_code # => true
  • 19. MORE EXCITING CHANGES That I would say are cool
  • 20. BETTER PERFORMANCE • Lots of work done here, e.g. freezing strings • Development mode now uses evented FS monitor, which is much faster than checking all files if they were updated, as it worked in Rails 4
  • 21. RAILS-API • rails new name --api • active_model_serializers • more or less works just like rails-api worked • it’s nice that the core rails team will be working on this
  • 22. ACTIONCABLE • It’s basically like Heroku pusher - websockets, push server… • Uses parts of faye-websocket and concurrent-ruby (threading lib) • Similar to faye, you subscribe to channels and then receive events in JS when new messages arrive. • It might not sound that useful but it actually has a lot of use cases
  • 23. ACTIONCONTROLLER::RENDERER • Refactor of ActionController • It makes it much easier to render templates outside of controllers (useful in delayed jobs and for ActionCable) • ApplicationController.render ‘sample/index' • ApplicationController.render assigns: { rails: 'Rails' }, inline: '<%= "Hello #{@rails}" %>’ • Makes this much easier when you need it. Before we had to do crazy stuff with AbstractController::Base
  • 24. ACTIVERECORD ATTRIBUTES • Basically allows you to define coercion rules for attributes. • It also works for virtual attributes. • It’s not that big of a deal, we could just define a getter and setter method to achieve the same thing. • But it is nice and may play with the framework better than just defining attribute accessor methods.
  • 25. ACTIVERECORD ATTRIBUTES class Book < ActiveRecord::Base end book.quantity # => 12.0 class Book < ActiveRecord::Base attribute :quantity, :integer end book.quantity # => 12 class Product < ApplicationRecord attribute :price_in_cents, MoneyType.new end class MoneyType < ActiveRecord::Type::Integer def type_cast(value) # convert values like '$10.00' to 1000 end end product = Product.new(price_in_cents: '$10.00') product.price_in_cents #=> 1000
  • 26. APPLICATIONRECORD • Now controllers inherit from ApplicationRecord instead of ActiveRecord::Base • Basically just so ActiveRecord::Base monkey- patching won’t have to be done, instead you do that in ApplicationRecord now, so if some gems use ActiveRecord::Base they won’t be affected by the monkey-patches.
  • 27. ACTIVERECORD OR • Finally we can use “or” in ActiveRecord • Unfortunately the API is a bit stupid imo • I prefer how it’s done in Sequel Book.where('status = 1').or(Book.where('status = 3')) Book.where(Sequel.or(status: 1, name: "Book")) Book.where { |t| { t.status => 1 } | { t.name => "Book" } }
  • 28. ACTIVERECORD IN_BATCHES Person.where('age >= 18').in_batches(of: 1000) do |people| people.update_all(can_vote: true) end
  • 29. BELONGS_TOVALIDATION • By default, when you have a belongs_to association you will automatically get a presence validation for it • You can explicitly make it optional: class Book < ActiveRecord::Base belongs_to :author, optional: true end
  • 30. ACTIVERECORD HOOKS • Until Rails 4, if you return false from a before_* hook, it would halt the whole operation (e.g. save) • In Rails 5, this is no longer the case. • You now have to use • Oh my godTHANKYOU throw(:abort)
  • 31. CONCLUSION • There are some new things, and not a lot of changes to existing APIs, so upgrading shouldn’t be too hard.Also use rails rails:update. • The belongs_to validation is one of the things you’ll have to be careful about. • We have better tools to create API projects, and if you’re not doing an API project, you have some newTurbolinks features to make everything snappier. • Similar release to Rails 4, there are not many breaking changes, and it’s a good thing. No need to fix something that’s not broken.