diff --git a/Gemfile b/Gemfile index 67f120da5c..fa039a05dd 100644 --- a/Gemfile +++ b/Gemfile @@ -54,6 +54,7 @@ group :development do gem 'rb-inotify', require: false gem 'rb-fsevent', require: false gem 'rb-fchange', require: false + gem 'rb-readline', platforms: %i[mingw mswin x64_mingw] gem 'brakeman', require: false end end diff --git a/Gemfile.lock b/Gemfile.lock index 287587d8fb..b25442f264 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -333,6 +333,8 @@ GEM rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) + rb-readline (0.5.5) + ref (2.0.0) regexp_parser (2.1.1) request_store (1.5.0) rack (>= 1.4) @@ -425,6 +427,8 @@ GEM timecop (0.9.4) tzinfo (1.2.9) thread_safe (~> 0.1) + tzinfo-data (1.2017.3) + tzinfo (>= 1.0.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (1.7.0) @@ -506,6 +510,7 @@ DEPENDENCIES rb-fchange rb-fsevent rb-inotify + rb-readline responders (~> 3.0) responds_to_parent! rspec-activemodel-mocks diff --git a/lib/fat_free_crm/gem_ext.rb b/lib/fat_free_crm/gem_ext.rb index 26735b4690..7f40b70914 100755 --- a/lib/fat_free_crm/gem_ext.rb +++ b/lib/fat_free_crm/gem_ext.rb @@ -6,5 +6,6 @@ # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require "fat_free_crm/gem_ext/active_support/buffered_logger" +require "fat_free_crm/gem_ext/active_support/polymorphic_url" require "fat_free_crm/gem_ext/action_controller/base" require "fat_free_crm/gem_ext/rake/task" if defined?(Rake) diff --git a/lib/fat_free_crm/gem_ext/active_support/polymorphic_url.rb b/lib/fat_free_crm/gem_ext/active_support/polymorphic_url.rb new file mode 100644 index 0000000000..a2c8eec60c --- /dev/null +++ b/lib/fat_free_crm/gem_ext/active_support/polymorphic_url.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# Copyright (c) 2008-2013 Michael Dvorkin and contributors. +# +# Fat Free CRM is freely distributable under the terms of MIT license. +# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php +#------------------------------------------------------------------------------ + +# Fixes https://github.com/rails/rails/pull/31746 +module FatFreeCRM + module SecurePolymorphicUrl + def polymorphic_url(record_or_hash_or_array, options = {}) + options[:secure] = true if Rails.configuration.force_ssl + super(record_or_hash_or_array, options) + end + end +end + +ActionDispatch::Routing::PolymorphicRoutes.send(:prepend, FatFreeCRM::SecurePolymorphicUrl)