SlideShare une entreprise Scribd logo
1  sur  30
Key features of Rails 5.2
By Namrata Ukirde
About me
I am team lead at Kiprosh. I usually work on Ruby on Rails and Ember.js. I love writing
poems, sometimes reading books. :P
@namrata_ukirde
● Active Storage
● Encrypted credentials
● HTTP/2 Early hints
● Redis cache store
Active Storage
What is rails active storage ?
Active Storage facilitates uploading files to a cloud storage service like
Amazon S3, Google Cloud Storage, or Microsoft Azure Storage and
attaching those files to Active Record objects. It comes with a local disk-
based service for development and testing and supports mirroring files to
subordinate services for backups and migrations.
How to use it ?
rails active_storage:install
It creates to tables in database:
● active_storage_blobs ( contains all metadata of file uploaded )
● active_storage_attachments ( join table between model and uploads which we create)
What all configuration we need
for it ?
Add config.active_storage.service = :local
Config -> environments -> development.rb/production.rb
Set service in
storage.yml
app/models/comment.rb
app/controllers/comments_controller.rb
comment.image.attached?
app/views/comments/new.html.erb
app/views/comments/show.html.erb
Request to server
Transforming images
To create a variation of the image, call variant on the Blob
Encrypted Credentials
Rails 5. 2 ? (Credentials - credentials.yml.enc)
Rails 5.1 ? (Encrypted Secrets - secrets.yml.enc)
Rails 4 ? (Secrets - secrets.yml)
Secrets.yml (Rails 4)
● Credentials.yml.enc
● master.key
Credentials.yml.enc (rails 5.2)
Added config/credentials.yml.enc file to store production app secrets.
EDITOR=vim rails credentials:edit
Open file in any editor to add actual details.
To check it from console
config/environments/production.rb
If upgrading from older version then add following line to
production.rb
For Production applications
● Make sure you add master.key file in .gitignore
(You can add actual key on server where you are deploying application
instead of directly committing it to git or any version control system)
● ENV[RAILS_MASTER_KEY]
(If you are using any continuous integration tool then you can add it there as
environment variable)
You can use EncryptedConfiguration through Rails.application.encrypted. Let's
say you want to encrypt some data and save the encrypted file on
top_secret.txt.enc.
encrypted = Rails.application.encrypted("top_secret.txt.enc")
This will create a new EncryptedConfiguration object which you can use to
encrypt and decrypt text.
encrypted.write("This is a top secret message.")
If you check the file top_secret.txt.enc, you will see :
EprXfkUXq/rlKQUTPg52OMoSUWfYnPHCiYqxd9y/URvVebmmuhap--QFtMHoVUYleOY8qC--
xadtJ2aVQJ2y0IDljt9yAg==
If you want to use a different key aside from config/master.key, create one by
running
ActiveSupport::EncryptedConfiguration.generate_key
o/p - 0dbcb53a3e52e6b983bd75d932dca52c
Save the key to a file. If you use config/top_secret.key as the file name, you can
get the EncryptedConfiguration object with
encrypted = Rails.application.encrypted("top_secret.txt.enc", key_path:
"config/top_secret.key")
Redis cache store
Rails 5.2 introduced built-in Redis cache store, which allows you to store cache
entries in Redis.
Add below line to environment file. (e.g config/environments/production.rb)
Config.cache_store = :redis_cache_store
In Rails 5.2, write_multi was added . Each cache store can implement this
method and provide the functionality to add multiple entries at once.
HTTP2/ Early hints
Early Hints is a new HTTP status code that allows your application to send links to assets
that you would like to load early. For example if you have a stylesheet and javascript file
included in your Rails application you may want to tell the client about them early so it can
start downloading them.
Check this blog post to know more about this feature.
Thank You
@namrata_ukirde

Contenu connexe

Tendances

OpenStack Swift的性能调优
OpenStack Swift的性能调优OpenStack Swift的性能调优
OpenStack Swift的性能调优Hardway Hou
 
Changing the world with ZeroVM and Swift
Changing the world with ZeroVM and SwiftChanging the world with ZeroVM and Swift
Changing the world with ZeroVM and SwiftJakub Krajcovic
 
Azure Blob Storage API for Scala and Spark
Azure Blob Storage API for Scala and SparkAzure Blob Storage API for Scala and Spark
Azure Blob Storage API for Scala and SparkBraja Krishna Das
 
Angular observables for fun and profit
Angular observables for fun and profitAngular observables for fun and profit
Angular observables for fun and profitGil Steiner
 
AWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud CustodianAWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud CustodianOlinData
 
A Brief Introduce to WSGI
A Brief Introduce to WSGIA Brief Introduce to WSGI
A Brief Introduce to WSGIMingli Yuan
 
Deploying swift on a scale out file system
Deploying swift on a scale out file systemDeploying swift on a scale out file system
Deploying swift on a scale out file systemDean Hildebrand
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...DataStax Academy
 
Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.
Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.
Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.Icinga
 
Women Who Code Connect 2018 Conference
Women Who Code Connect 2018 ConferenceWomen Who Code Connect 2018 Conference
Women Who Code Connect 2018 ConferenceSupriya Premkumar
 
Python WSGI introduction
Python WSGI introductionPython WSGI introduction
Python WSGI introductionAgeeleshwar K
 
K8s in 2hours
K8s in 2hoursK8s in 2hours
K8s in 2hoursDEV Cafe
 
Introduction to Shield and kibana
Introduction to Shield and kibanaIntroduction to Shield and kibana
Introduction to Shield and kibanaKnoldus Inc.
 
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
Data management with ado
Data management with adoData management with ado
Data management with adoDinesh kumar
 
Rapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild sideRapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild sideSamrat Saha
 
Elasticsearch python
Elasticsearch pythonElasticsearch python
Elasticsearch pythonvaliantval2
 
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...MongoDB
 

Tendances (20)

OpenStack Swift的性能调优
OpenStack Swift的性能调优OpenStack Swift的性能调优
OpenStack Swift的性能调优
 
Changing the world with ZeroVM and Swift
Changing the world with ZeroVM and SwiftChanging the world with ZeroVM and Swift
Changing the world with ZeroVM and Swift
 
Azure Blob Storage API for Scala and Spark
Azure Blob Storage API for Scala and SparkAzure Blob Storage API for Scala and Spark
Azure Blob Storage API for Scala and Spark
 
Angular observables for fun and profit
Angular observables for fun and profitAngular observables for fun and profit
Angular observables for fun and profit
 
AWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud CustodianAWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud Custodian
 
A Brief Introduce to WSGI
A Brief Introduce to WSGIA Brief Introduce to WSGI
A Brief Introduce to WSGI
 
Butter knife ppt
Butter knife pptButter knife ppt
Butter knife ppt
 
Deploying swift on a scale out file system
Deploying swift on a scale out file systemDeploying swift on a scale out file system
Deploying swift on a scale out file system
 
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
Cassandra Summit 2014: Highly Scalable Web Application in the Cloud with Cass...
 
Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.
Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.
Icinga Camp Bangalore - Icinga2 API use cases and BlueJeans Inc.
 
Women Who Code Connect 2018 Conference
Women Who Code Connect 2018 ConferenceWomen Who Code Connect 2018 Conference
Women Who Code Connect 2018 Conference
 
Python WSGI introduction
Python WSGI introductionPython WSGI introduction
Python WSGI introduction
 
K8s in 2hours
K8s in 2hoursK8s in 2hours
K8s in 2hours
 
Introduction to Shield and kibana
Introduction to Shield and kibanaIntroduction to Shield and kibana
Introduction to Shield and kibana
 
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
 
Data management with ado
Data management with adoData management with ado
Data management with ado
 
Rapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild sideRapid prototyping using azure functions - A walk on the wild side
Rapid prototyping using azure functions - A walk on the wild side
 
Elasticsearch python
Elasticsearch pythonElasticsearch python
Elasticsearch python
 
Docker in OpenStack
Docker in OpenStackDocker in OpenStack
Docker in OpenStack
 
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
 

Similaire à Key Rails 5.2 Features: Active Storage, Encrypted Credentials & More

23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqra23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqraijaprr_editor
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdfBOSC Tech Labs
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
08 - kubernetes.pptx
08 - kubernetes.pptx08 - kubernetes.pptx
08 - kubernetes.pptxRanjithM61
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)M Malai
 
Ansible is Our Wishbone
Ansible is Our WishboneAnsible is Our Wishbone
Ansible is Our WishboneMydbops
 
Extend Eclipse p2 framework capabilities: Add your custom installation steps
Extend Eclipse p2 framework capabilities: Add your custom installation stepsExtend Eclipse p2 framework capabilities: Add your custom installation steps
Extend Eclipse p2 framework capabilities: Add your custom installation stepsDragos_Mihailescu
 
Ranger admin dev overview
Ranger admin dev overviewRanger admin dev overview
Ranger admin dev overviewTushar Dudhatra
 
Kubernetes acomprehensiveoverview
Kubernetes acomprehensiveoverviewKubernetes acomprehensiveoverview
Kubernetes acomprehensiveoverviewAnkit Shukla
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewBob Killen
 
Kubernetes a comprehensive overview
Kubernetes   a comprehensive overviewKubernetes   a comprehensive overview
Kubernetes a comprehensive overviewGabriel Carro
 
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud EnvironmentsUsing Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environmentsahamilton55
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive OverviewBob Killen
 

Similaire à Key Rails 5.2 Features: Active Storage, Encrypted Credentials & More (20)

23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqra23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqra
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf
 
Readme
ReadmeReadme
Readme
 
Managing Postgres with Ansible
Managing Postgres with AnsibleManaging Postgres with Ansible
Managing Postgres with Ansible
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
08 - kubernetes.pptx
08 - kubernetes.pptx08 - kubernetes.pptx
08 - kubernetes.pptx
 
Kubernetes PPT.pptx
Kubernetes PPT.pptxKubernetes PPT.pptx
Kubernetes PPT.pptx
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
 
Ansible is Our Wishbone
Ansible is Our WishboneAnsible is Our Wishbone
Ansible is Our Wishbone
 
Extend Eclipse p2 framework capabilities: Add your custom installation steps
Extend Eclipse p2 framework capabilities: Add your custom installation stepsExtend Eclipse p2 framework capabilities: Add your custom installation steps
Extend Eclipse p2 framework capabilities: Add your custom installation steps
 
Catalyst MVC
Catalyst MVCCatalyst MVC
Catalyst MVC
 
MySQL Cluster Basics
MySQL Cluster BasicsMySQL Cluster Basics
MySQL Cluster Basics
 
Ranger admin dev overview
Ranger admin dev overviewRanger admin dev overview
Ranger admin dev overview
 
Kubernetes acomprehensiveoverview
Kubernetes acomprehensiveoverviewKubernetes acomprehensiveoverview
Kubernetes acomprehensiveoverview
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Create a new project in ROR
Create a new project in RORCreate a new project in ROR
Create a new project in ROR
 
Kubernetes a comprehensive overview
Kubernetes   a comprehensive overviewKubernetes   a comprehensive overview
Kubernetes a comprehensive overview
 
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud EnvironmentsUsing Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environments
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview
 

Dernier

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Dernier (20)

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Key Rails 5.2 Features: Active Storage, Encrypted Credentials & More

  • 1. Key features of Rails 5.2 By Namrata Ukirde
  • 2. About me I am team lead at Kiprosh. I usually work on Ruby on Rails and Ember.js. I love writing poems, sometimes reading books. :P @namrata_ukirde
  • 3. ● Active Storage ● Encrypted credentials ● HTTP/2 Early hints ● Redis cache store
  • 5. What is rails active storage ?
  • 6. Active Storage facilitates uploading files to a cloud storage service like Amazon S3, Google Cloud Storage, or Microsoft Azure Storage and attaching those files to Active Record objects. It comes with a local disk- based service for development and testing and supports mirroring files to subordinate services for backups and migrations.
  • 7. How to use it ?
  • 8. rails active_storage:install It creates to tables in database: ● active_storage_blobs ( contains all metadata of file uploaded ) ● active_storage_attachments ( join table between model and uploads which we create)
  • 9.
  • 10. What all configuration we need for it ?
  • 11. Add config.active_storage.service = :local Config -> environments -> development.rb/production.rb
  • 17. Transforming images To create a variation of the image, call variant on the Blob
  • 19. Rails 5. 2 ? (Credentials - credentials.yml.enc) Rails 5.1 ? (Encrypted Secrets - secrets.yml.enc) Rails 4 ? (Secrets - secrets.yml)
  • 22. Credentials.yml.enc (rails 5.2) Added config/credentials.yml.enc file to store production app secrets.
  • 23. EDITOR=vim rails credentials:edit Open file in any editor to add actual details.
  • 24. To check it from console config/environments/production.rb If upgrading from older version then add following line to production.rb
  • 25. For Production applications ● Make sure you add master.key file in .gitignore (You can add actual key on server where you are deploying application instead of directly committing it to git or any version control system) ● ENV[RAILS_MASTER_KEY] (If you are using any continuous integration tool then you can add it there as environment variable)
  • 26. You can use EncryptedConfiguration through Rails.application.encrypted. Let's say you want to encrypt some data and save the encrypted file on top_secret.txt.enc. encrypted = Rails.application.encrypted("top_secret.txt.enc") This will create a new EncryptedConfiguration object which you can use to encrypt and decrypt text. encrypted.write("This is a top secret message.") If you check the file top_secret.txt.enc, you will see : EprXfkUXq/rlKQUTPg52OMoSUWfYnPHCiYqxd9y/URvVebmmuhap--QFtMHoVUYleOY8qC-- xadtJ2aVQJ2y0IDljt9yAg==
  • 27. If you want to use a different key aside from config/master.key, create one by running ActiveSupport::EncryptedConfiguration.generate_key o/p - 0dbcb53a3e52e6b983bd75d932dca52c Save the key to a file. If you use config/top_secret.key as the file name, you can get the EncryptedConfiguration object with encrypted = Rails.application.encrypted("top_secret.txt.enc", key_path: "config/top_secret.key")
  • 28. Redis cache store Rails 5.2 introduced built-in Redis cache store, which allows you to store cache entries in Redis. Add below line to environment file. (e.g config/environments/production.rb) Config.cache_store = :redis_cache_store In Rails 5.2, write_multi was added . Each cache store can implement this method and provide the functionality to add multiple entries at once.
  • 29. HTTP2/ Early hints Early Hints is a new HTTP status code that allows your application to send links to assets that you would like to load early. For example if you have a stylesheet and javascript file included in your Rails application you may want to tell the client about them early so it can start downloading them. Check this blog post to know more about this feature.