https://github.com/driftingruby/113-ruby-on-rails-5-2-0-changes-and-new-features
https://github.com/driftingruby/113-ruby-on-rails-5-2-0-changes-and-new-features
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/driftingruby/113-ruby-on-rails-5-2-0-changes-and-new-features
- Owner: driftingruby
- Created: 2018-10-04T02:17:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-04T02:17:50.000Z (over 7 years ago)
- Last Synced: 2025-02-15T08:31:25.216Z (over 1 year ago)
- Language: Ruby
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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 >