#113 Ruby on Rails 5.2.0 Changes and New Features
1-7-2018

Summary

Upcoming features include ActiveStorage, built-in Redis Cache Store, updated Rails Credentials and a bunch of other cool things! Honorable mentions also to the new Stimulus Javascript Framework.
8
rails beta 6:16

Summary

gem install rails --pre
EDITOR="code --wait" bin/rails credentials:edit
rails c
2.4.2 :001 > Rails.application.credentials.test
 => "value"
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
Rails.application.config.content_security_policy do |p|
  p.default_src :self, :https, 'http://localhost:9200'
  p.font_src :self, :https, :data
  p.img_src :self, :https, :data
  p.object_src :none
  p.script_src :self, :https
  p.style_src :self, :https, :unsafe_inline
  # Specify URI for violation reports
  # p.report_uri "/csp-violation-report-endpoint"
end
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true
# Override policy inline
class PostsController < ApplicationController
  content_security_policy do |p|
    p.upgrade_insecure_requests true
  end
end
# Using literal values
class PostsController < ApplicationController
  content_security_policy do |p|
    p.base_uri "https://www.example.com"
  end
end
# Using mixed static and dynamic values
class PostsController < ApplicationController
  content_security_policy do |p|
    p.base_uri :self, -> { "https://#{current_user.domain}.example.com" }
  end
end
<%= form_with model, id: 'model' do |f| %>
<% end %>
config.action_view.form_with_generates_ids = false
2.4.2 :001 > Time.new.next_year
 => 2019-01-07 20:51:11 -0500
2.4.2 :002 > Time.new.next_year(4)
 => 2022-01-07 20:51:15 -0500
2.4.2 :003 > Time.new.next_month(4)
 => 2018-05-07 20:51:29 -0400
2.4.2 :004 > Time.new.prev_month(4)
 => 2017-09-07 20:51:42 -0400
2.4.2 :005 > Time.new.prev_day(4)
 => 2018-01-03 20:51:59 -0500
2.4.2 :006 >
there are turning to ah to add a turn around and learned lessons that but look it's in the upcoming changes and miles wide and one of the big is the most notable changes is the addition of fact of storage which is a top loading framework it has a lot also features are really excited about in some nice features include wrecked up with the cloud storage progress bars for your follow up loads and then being able to grieve any ensure we sizing images on the fly and if you want a deeper dive into active sort check out the pro etc hunter the web and write going to allow the different features of the actors storage in another pretty big feature it's able to read this cash for which still supports even know the red ensign i read as the banal smells of course the rent is tissue you did and it's going to allow old self like a multi read in a multi right so let's create a new browser book issue of spells fight it so does our we need to install rails far too would you do that with jim install rails and then pass in the dash dash free option we'll see their real says now successfully installed what you do the rails dash be to see what version were running so that we could do whales new template that does create a new application called template the person they you may notice at the bottom it is anyone's a task on actors were just all which is simply creates a migration and another major changes adding that the content scary policy which basically means that if you look at the cafe can finish lighters contest could be palsy better be filed you'll see that there's a lot of options in here and these are basically winning your application only speak to the scanner sources of yemen and age then it's only going to dissuade be image warner screen but the image source is coming from the rail service for example being murdered by your assets events over h t t p s or said something like it basically for data and if you do have something that you need to refer to the your soul able to do that maybe in your dressing up i read your able to put any specific coast and eight or if you need to as something like this may come in handy if you use a website that server the launch a sense to them point is to it so it'll pick up those assets they're not a cool feature about the contents party policy is say you're able to override it directly within the controller on a practical or basis so you see that here in this case it may pose controller then the block and a cartoon strip all sleep we're just saying the upgrade insecure requests in setting that the truth it also use liberal values so if the base your like me you put in a specific u r l they eat it all season dynamic in a it's another feature is something that they have dealt with a male or someone to create a male or an undiscovered call this my email or they'll create my file under the app miller's my mail or so within the my male or we now have the option to specify a cause some to leverage on he he do that with self dot delivery job the sad to see what you would ever active job that you have created for it and also with the forum with an all mountain read the idea that the vault sit idle had to pass and the idea of the form it is going to create a base on the model and if you would override this within your application being go into your tooth aches and it is called a fake action view then before with generates ids and just said this a fox and if he had to mess around with high much if he did kind of knew if you wanna get something in the future or in the previous you've always had the options was only like next year no you vaccinate option has the net and to jerk then i'll jump that many years for work in addition to the euro months you can also jump between days they're also making changes to real secrets so before we would run an order in your favor enter dash s wait if you're uses of it as ago we played little city upload the people that rails secrets at it the rails fight him go see that it says that this is dedicated instead you should just one credentials help and this will give you a list of options so did that to sell orders for my enter code that shares way because i am using visual studio code then the big wales with the tools at it this will bring up the file the wiki then make our changes too someone created he called test then the valley and editors of the value that we can open up for rails console if we can ride the rails that application that credentials dot test the beginner value and also recently put out a list of all they will spike use your depth cage it's and this one guy that did for rose five one zero and the response of it was pretty good so i decided to go and do it for the beta version now keep this up to date as he weaves candid and the final version comes out but with didier you click on each one the links to get the change log preach would be respected areas and use to talk circuit have a lot of good information so if you're working with wells quite a bit ahead of labour coming coming in here and just take a glance at some of the logs to see what has changed airway demeaning to be aware of an overall have been really happy with the rails five to zero because it doesn't look like they were too many breaking changes the migration from browse five zero or five one zero should be pretty pale is to get up to five to zero in a notable major that's not part of the bills from work but it is something that they skip road and the ease with a base camp quite a bit isn't a jump scare friend were called stimulus and so was not part of the will score editing bay it's a notable mentioned and deftly sub in asia check out it made the pro episode hundred twelve we did get into the study was so struck framework probably look at some the different features and has to offer well that's all for this episode they keep watching