From 1d3e1b35a834059d34bfa683b17d201a2bc35b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 18:34:43 +0200 Subject: [PATCH 01/13] Test newer Ruby versions Ruby 2.3.3 is not the latest version in 2.3 series. Test that the project works in Ruby 2.3.4 and patch bugs if it doesn't. Plus, start testing compatibility with Ruby 2.4 series. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0d78a134..39b4f959 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ branches: - master rvm: - 2.3.3 + - 2.3.4 + - 2.4.1 services: - postgresql env: From 3c91294cf116be1f9f3fbda26ca2968d4a10f9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 18:44:29 +0200 Subject: [PATCH 02/13] Remove unused opinions_helper_spec.rb --- spec/helpers/dashboard/opinions_helper_spec.rb | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 spec/helpers/dashboard/opinions_helper_spec.rb diff --git a/spec/helpers/dashboard/opinions_helper_spec.rb b/spec/helpers/dashboard/opinions_helper_spec.rb deleted file mode 100644 index a907c1e2..00000000 --- a/spec/helpers/dashboard/opinions_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'rails_helper' - -# Specs in this file have access to a helper object that includes -# the Dashboard::OpinionsHelper. For example: -# -# describe Dashboard::OpinionsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# expect(helper.concat_strings("this","that")).to eq("this that") -# end -# end -# end -RSpec.describe Dashboard::OpinionsHelper, type: :helper do - pending "add some examples to (or delete) #{__FILE__}" -end From 51f66534e7429e336d227d2ba354ecc0c7cba004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 18:50:45 +0200 Subject: [PATCH 03/13] Flip action_controller.per_form_csrf_tokens No bugs so far. --- config/initializers/new_framework_defaults.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index f6e72335..dcff575e 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -7,7 +7,7 @@ # Read the Rails 5.0 release notes for more info on each option. # Enable per-form CSRF tokens. Previous versions had false. -Rails.application.config.action_controller.per_form_csrf_tokens = false +Rails.application.config.action_controller.per_form_csrf_tokens = true # Enable origin-checking CSRF mitigation. Previous versions had false. Rails.application.config.action_controller.forgery_protection_origin_check = false From f8b715ad784ba419cdfaa9aea4f28c0a9189e834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 18:55:22 +0200 Subject: [PATCH 04/13] Flip forgery_protection_origin_check --- config/initializers/new_framework_defaults.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index dcff575e..7ad3e7ad 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -10,7 +10,7 @@ Rails.application.config.action_controller.per_form_csrf_tokens = true # Enable origin-checking CSRF mitigation. Previous versions had false. -Rails.application.config.action_controller.forgery_protection_origin_check = false +Rails.application.config.action_controller.forgery_protection_origin_check = true # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. # Previous versions had false. From 15f2c6dba963c5306837c739931913ae2e3ffd26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 19:02:32 +0200 Subject: [PATCH 05/13] Flip to_time_preserves_timezone --- config/initializers/new_framework_defaults.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index 7ad3e7ad..0c2ff067 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -14,7 +14,7 @@ # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. # Previous versions had false. -ActiveSupport.to_time_preserves_timezone = false +ActiveSupport.to_time_preserves_timezone = true # Require `belongs_to` associations by default. Previous versions had false. Rails.application.config.active_record.belongs_to_required_by_default = false From b764d1c230032b59e98f6aa861243dba927993bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 19:06:54 +0200 Subject: [PATCH 06/13] Flip active_record.belongs_to_required_by_default --- config/initializers/new_framework_defaults.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index 0c2ff067..4d1c5151 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -17,7 +17,7 @@ ActiveSupport.to_time_preserves_timezone = true # Require `belongs_to` associations by default. Previous versions had false. -Rails.application.config.active_record.belongs_to_required_by_default = false +Rails.application.config.active_record.belongs_to_required_by_default = true # Do not halt callback chains when a callback returns false. Previous versions had true. ActiveSupport.halt_callback_chains_on_return_false = true From fef45d94438de304fa9973d7ec6326d1f3410b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 21:48:02 +0200 Subject: [PATCH 07/13] Flip halt_callback_chains_on_return_false --- config/initializers/new_framework_defaults.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index 4d1c5151..254c8b15 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -20,4 +20,4 @@ Rails.application.config.active_record.belongs_to_required_by_default = true # Do not halt callback chains when a callback returns false. Previous versions had true. -ActiveSupport.halt_callback_chains_on_return_false = true +ActiveSupport.halt_callback_chains_on_return_false = false From 5456963f1950839a33a2f4c26de341ddd0b5795c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 21:48:14 +0200 Subject: [PATCH 08/13] Adopted Rails 5.0 framework defaults The file new_framework_defaults is dropped now since all the defaults have been merged and unit tests still validate. --- config/initializers/new_framework_defaults.rb | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 config/initializers/new_framework_defaults.rb diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb deleted file mode 100644 index 254c8b15..00000000 --- a/config/initializers/new_framework_defaults.rb +++ /dev/null @@ -1,23 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains migration options to ease your Rails 5.0 upgrade. -# -# Once upgraded flip defaults one by one to migrate to the new default. -# -# Read the Rails 5.0 release notes for more info on each option. - -# Enable per-form CSRF tokens. Previous versions had false. -Rails.application.config.action_controller.per_form_csrf_tokens = true - -# Enable origin-checking CSRF mitigation. Previous versions had false. -Rails.application.config.action_controller.forgery_protection_origin_check = true - -# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. -# Previous versions had false. -ActiveSupport.to_time_preserves_timezone = true - -# Require `belongs_to` associations by default. Previous versions had false. -Rails.application.config.active_record.belongs_to_required_by_default = true - -# Do not halt callback chains when a callback returns false. Previous versions had true. -ActiveSupport.halt_callback_chains_on_return_false = false From ecbac746c8a25a858b17d7ad776959edc4a44940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 22:08:27 +0200 Subject: [PATCH 09/13] Update Rails version to 5.1(.1) --- Gemfile | 2 +- Gemfile.lock | 75 ++++++++++++++++++++++++++-------------------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/Gemfile b/Gemfile index d4e963d8..54fa99ab 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '5.0.3' +gem 'rails', '5.1.1' gem 'rails-i18n', '~> 5.0.0' gem 'dotenv-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 5de4ce52..932e1d72 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,39 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.3) - actionpack (= 5.0.3) - nio4r (>= 1.2, < 3.0) + actioncable (5.1.1) + actionpack (= 5.1.1) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.3) - actionpack (= 5.0.3) - actionview (= 5.0.3) - activejob (= 5.0.3) + actionmailer (5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.3) - actionview (= 5.0.3) - activesupport (= 5.0.3) + actionpack (5.1.1) + actionview (= 5.1.1) + activesupport (= 5.1.1) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.3) - activesupport (= 5.0.3) + actionview (5.1.1) + activesupport (= 5.1.1) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.3) - activesupport (= 5.0.3) + activejob (5.1.1) + activesupport (= 5.1.1) globalid (>= 0.3.6) - activemodel (5.0.3) - activesupport (= 5.0.3) - activerecord (5.0.3) - activemodel (= 5.0.3) - activesupport (= 5.0.3) - arel (~> 7.0) - activesupport (5.0.3) + activemodel (5.1.1) + activesupport (= 5.1.1) + activerecord (5.1.1) + activemodel (= 5.1.1) + activesupport (= 5.1.1) + arel (~> 8.0) + activesupport (5.1.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -44,7 +44,7 @@ GEM public_suffix (~> 2.0, >= 2.0.2) airbrussh (1.2.0) sshkit (>= 1.6.1, != 1.7.0) - arel (7.1.4) + arel (8.0.0) bcrypt (3.1.11) bindex (0.5.0) bootstrap-kaminari-views (0.0.5) @@ -89,6 +89,7 @@ GEM dotenv-rails (2.2.1) dotenv (= 2.2.1) railties (>= 3.2, < 5.2) + erubi (1.6.0) erubis (2.7.0) execjs (2.7.0) factory_girl (4.8.0) @@ -166,17 +167,17 @@ GEM rack (2.0.3) rack-test (0.6.3) rack (>= 1.0) - rails (5.0.3) - actioncable (= 5.0.3) - actionmailer (= 5.0.3) - actionpack (= 5.0.3) - actionview (= 5.0.3) - activejob (= 5.0.3) - activemodel (= 5.0.3) - activerecord (= 5.0.3) - activesupport (= 5.0.3) + rails (5.1.1) + actioncable (= 5.1.1) + actionmailer (= 5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) + activemodel (= 5.1.1) + activerecord (= 5.1.1) + activesupport (= 5.1.1) bundler (>= 1.3.0, < 2.0) - railties (= 5.0.3) + railties (= 5.1.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -186,9 +187,9 @@ GEM rails-i18n (5.0.4) i18n (~> 0.7) railties (~> 5.0) - railties (5.0.3) - actionpack (= 5.0.3) - activesupport (= 5.0.3) + railties (5.1.1) + actionpack (= 5.1.1) + activesupport (= 5.1.1) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -289,7 +290,7 @@ DEPENDENCIES paperclip pg puma (~> 3.0) - rails (= 5.0.3) + rails (= 5.1.1) rails-i18n (~> 5.0.0) redcarpet rspec-rails (~> 3.4) From 883f684b6cd3d4b25cecc8800f3645765e027de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 22:23:44 +0200 Subject: [PATCH 10/13] Runs rake app:update with all the joy Isn't it always a joy running app:update and letting Rails ask you if you want to remove all your configuration? I have learnt now that the best way for dealing with this is to just replace every file when app:update asks so, but then spend time using git add -p. --- bin/setup | 4 ++ bin/yarn | 11 ++++ config/application.rb | 3 + config/cable.yml | 1 + config/environments/development.rb | 6 +- config/environments/production.rb | 7 ++- config/environments/test.rb | 2 +- config/initializers/assets.rb | 7 ++- .../new_framework_defaults_5_1.rb | 14 +++++ config/locales/en.yml | 10 ++++ config/puma.rb | 58 ++++++++++++++++--- config/routes.rb | 1 + config/secrets.yml | 22 +++++-- 13 files changed, 126 insertions(+), 20 deletions(-) create mode 100755 bin/yarn create mode 100644 config/initializers/new_framework_defaults_5_1.rb diff --git a/bin/setup b/bin/setup index e620b4da..78c4e861 100755 --- a/bin/setup +++ b/bin/setup @@ -18,6 +18,10 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # cp 'config/database.yml.sample', 'config/database.yml' diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 00000000..c2bacef8 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 8a6ead6a..bb45482b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,9 @@ module Makigas class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.1 + # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. diff --git a/config/cable.yml b/config/cable.yml index 0bbde6f7..c08223c2 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -7,3 +7,4 @@ test: production: adapter: redis url: redis://localhost:6379/1 + channel_prefix: makigas_production diff --git a/config/environments/development.rb b/config/environments/development.rb index 3f3418f4..d1ccc695 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,7 +18,7 @@ config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=172800' + 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" } else config.action_controller.perform_caching = false @@ -28,6 +28,7 @@ # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + config.action_mailer.perform_caching = false config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } @@ -50,7 +51,6 @@ # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. - # config.file_watcher = ActiveSupport::EventedFileUpdateChecker - + config.file_watcher = ActiveSupport::EventedFileUpdateChecker Paperclip.options[:command_path] = "/usr/local/bin/" end diff --git a/config/environments/production.rb b/config/environments/production.rb index 1b6ce1a7..66e17ad2 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,6 +14,11 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = true + # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? @@ -79,7 +84,7 @@ if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) + config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. diff --git a/config/environments/test.rb b/config/environments/test.rb index 006c1cad..4fc9260b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -15,7 +15,7 @@ # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=3600' + 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" } # Show full error reports and disable caching. diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index d9e1f142..bb77deb7 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,9 +3,12 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' -# Add additional assets to the asset load path +# Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. Rails.application.config.assets.precompile += %w( dashboard/dashboard.css dashboard/dashboard.js ) diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb new file mode 100644 index 00000000..9010abd5 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Unknown asset fallback will return the path passed in when the given +# asset is not present in the asset pipeline. +# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/locales/en.yml b/config/locales/en.yml index 06539571..decc5a85 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,16 @@ # # This would use the information in config/locales/es.yml. # +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. diff --git a/config/puma.rb b/config/puma.rb index af3c36d9..ac8b7a8b 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,16 +1,60 @@ -workers ENV.fetch("WEB_CONCURRENCY") { 2 } -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads threads_count, threads_count preload_app! +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } -port ENV.fetch("PORT") { 3000 } -environment ENV.fetch("RAILS_ENV") { 'development' } +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } bind 'unix://tmp/sockets/puma.sock' pidfile 'tmp/pids/puma.pid' state_path 'tmp/pids/puma.state' +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } -on_worker_boot do - ActiveRecord::Base.establish_connection -end \ No newline at end of file +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end +# + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb index c71e991b..92c0de68 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html devise_for :users, controllers: { sessions: 'users/sessions', passwords: 'users/passwords' diff --git a/config/secrets.yml b/config/secrets.yml index 75ab7f28..690f9e3f 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -5,19 +5,29 @@ # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -# You can use `rake secret` to generate a secure secret key. +# You can use `rails secret` to generate a secure secret key. # Make sure the secrets in this file are kept private # if you're sharing your code publicly. -# + +# Shared secrets are available across all environments. + +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + development: - secret_key_base: 1e8a4cca01a58ab35d8817afadd5021e074916cf50d5421ebc52bff8363c7cd3460d2568edc6e60f1802652bb9e65a988abba2a3446bcca17c09f9911946287d + secret_key_base: 4286070ac3ad69be6836eb7722800b9433bb1048e2de0caab5ae80aa99938ad230f1c3410f5f73594eaf43d3df7a89a35c75a6a5380d09199d70a17ae2336ba1 test: - secret_key_base: e7142a718c21b0f391ebe8290ab1a7f5e32bb48ad1fc6079cc0f7afd69893a45655e28b9819f1499557d888956e1537abc892b59e813024075ffa0a3622a1d0f + secret_key_base: cbbbf582e854f7504fc5f3eb30b2d039e4cfe85178b6c5dbc107388de2f3a9e252e5b7c70376c1dc362e0bb85491dfad40a3b078a65bda3da33bd8dd5ac3d5f4 + +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. -# Do not keep production secrets in the repository, -# instead read values from the environment. production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> analytics_key: <%= ENV["GOOGLE_ANALYTICS_KEY"] %> From d7d3e3a4a580a2ac0f202691f4e7dd033259b244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 22:38:28 +0200 Subject: [PATCH 11/13] Playlists don't have to belong to a topic This seems to be something new on Rails 5.1. --- app/models/playlist.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/playlist.rb b/app/models/playlist.rb index e000342d..5f0848f4 100644 --- a/app/models/playlist.rb +++ b/app/models/playlist.rb @@ -25,7 +25,7 @@ class Playlist < ApplicationRecord validates_attachment :card, content_type: { content_type: /\Aimage\/.*\z/ } has_many :videos, -> { order(position: :asc) } - belongs_to :topic + belongs_to :topic, required: false def total_length videos.map { |v| v.duration }.reduce(0, :+) From ed5bf32a1b9a8e3220897fa92666352b3df0f818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 22:44:40 +0200 Subject: [PATCH 12/13] Flip form_with_generates_remote_forms --- config/initializers/new_framework_defaults_5_1.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb index 9010abd5..704be2dd 100644 --- a/config/initializers/new_framework_defaults_5_1.rb +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -7,7 +7,7 @@ # Read the Guide for Upgrading Ruby on Rails for more info on each option. # Make `form_with` generate non-remote forms. -Rails.application.config.action_view.form_with_generates_remote_forms = false +Rails.application.config.action_view.form_with_generates_remote_forms = true # Unknown asset fallback will return the path passed in when the given # asset is not present in the asset pipeline. From 845e71d6ef66fd980f544ecb80468ff6c333ed46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rodr=C3=ADguez?= Date: Fri, 2 Jun 2017 22:44:48 +0200 Subject: [PATCH 13/13] Drop new_framework_defaults_5.1 App is fully ported to 5.1. --- config/initializers/new_framework_defaults_5_1.rb | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 config/initializers/new_framework_defaults_5_1.rb diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb deleted file mode 100644 index 704be2dd..00000000 --- a/config/initializers/new_framework_defaults_5_1.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains migration options to ease your Rails 5.1 upgrade. -# -# Once upgraded flip defaults one by one to migrate to the new default. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. - -# Make `form_with` generate non-remote forms. -Rails.application.config.action_view.form_with_generates_remote_forms = true - -# Unknown asset fallback will return the path passed in when the given -# asset is not present in the asset pipeline. -# Rails.application.config.assets.unknown_asset_fallback = false