diff options
Diffstat (limited to 'config/initializers')
| -rw-r--r-- | config/initializers/assets.rb | 1 | ||||
| -rw-r--r-- | config/initializers/backtrace_silencers.rb | 7 | ||||
| -rw-r--r-- | config/initializers/new_rails_defaults.rb | 19 | ||||
| -rw-r--r-- | config/initializers/routing_filter_rails71_patch.rb | 38 | ||||
| -rw-r--r-- | config/initializers/ruby2.rb | 16 |
5 files changed, 38 insertions, 43 deletions
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb deleted file mode 100644 index 938e89d..0000000 --- a/config/initializers/assets.rb +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | Rails.application.config.assets.precompile += %w( jquery.js jquery_ujs.js ) | ||
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb deleted file mode 100644 index c2169ed..0000000 --- a/config/initializers/backtrace_silencers.rb +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | # Be sure to restart your server when you modify this file. | ||
| 2 | |||
| 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. | ||
| 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } | ||
| 5 | |||
| 6 | # You can also remove all the silencers if you're trying do debug a problem that might steem from framework code. | ||
| 7 | # Rails.backtrace_cleaner.remove_silencers! \ No newline at end of file | ||
diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb deleted file mode 100644 index 8ec3186..0000000 --- a/config/initializers/new_rails_defaults.rb +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | # Be sure to restart your server when you modify this file. | ||
| 2 | |||
| 3 | # These settings change the behavior of Rails 2 apps and will be defaults | ||
| 4 | # for Rails 3. You can remove this initializer when Rails 3 is released. | ||
| 5 | |||
| 6 | if defined?(ActiveRecord) | ||
| 7 | # Include Active Record class name as root for JSON serialized output. | ||
| 8 | ActiveRecord::Base.include_root_in_json = true | ||
| 9 | |||
| 10 | # Store the full class name (including module namespace) in STI type column. | ||
| 11 | ActiveRecord::Base.store_full_sti_class = true | ||
| 12 | end | ||
| 13 | |||
| 14 | # Use ISO 8601 format for JSON serialized times and dates. | ||
| 15 | ActiveSupport.use_standard_json_time_format = true | ||
| 16 | |||
| 17 | # Don't escape HTML entities in JSON, leave that for the #json_escape helper. | ||
| 18 | # if you're including raw json in an HTML page. | ||
| 19 | ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file | ||
diff --git a/config/initializers/routing_filter_rails71_patch.rb b/config/initializers/routing_filter_rails71_patch.rb new file mode 100644 index 0000000..35e3576 --- /dev/null +++ b/config/initializers/routing_filter_rails71_patch.rb | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | # routing-filter 0.7.0 is broken on Rails 7.1+ due to a change in how | ||
| 2 | # ActionDispatch::Journey::Router#find_routes yields results (lazy iterator | ||
| 3 | # vs eager enumerable). This patch restores the expected behaviour. | ||
| 4 | # See: https://github.com/svenfuchs/routing-filter/pull/87 | ||
| 5 | # Remove this file if routing-filter ever releases a fixed version, | ||
| 6 | # or when routing-filter is replaced with native Rails i18n scope routing. | ||
| 7 | |||
| 8 | if Gem.loaded_specs['routing-filter'].version > Gem::Version.new('0.7.0') | ||
| 9 | raise 'routing-filter has been updated — check if this patch is still needed and remove it if so.' | ||
| 10 | end | ||
| 11 | |||
| 12 | ActionDispatchJourneyRouterWithFiltering.remove_method(:find_routes) | ||
| 13 | |||
| 14 | module RoutingFilterRails71Fix | ||
| 15 | def find_routes(env) | ||
| 16 | path = env.is_a?(Hash) ? env['PATH_INFO'] : env.path_info | ||
| 17 | filter_parameters = {} | ||
| 18 | original_path = path.dup | ||
| 19 | |||
| 20 | @routes.filters.run(:around_recognize, path, env) do | ||
| 21 | filter_parameters | ||
| 22 | end | ||
| 23 | |||
| 24 | super(env) do |match, parameters, route| | ||
| 25 | parameters = parameters.merge(filter_parameters) | ||
| 26 | |||
| 27 | if env.is_a?(Hash) | ||
| 28 | env['PATH_INFO'] = original_path | ||
| 29 | else | ||
| 30 | env.path_info = original_path | ||
| 31 | end | ||
| 32 | |||
| 33 | yield [match, parameters, route] | ||
| 34 | end | ||
| 35 | end | ||
| 36 | end | ||
| 37 | |||
| 38 | ActionDispatch::Journey::Router.prepend(RoutingFilterRails71Fix) | ||
diff --git a/config/initializers/ruby2.rb b/config/initializers/ruby2.rb deleted file mode 100644 index d2d62aa..0000000 --- a/config/initializers/ruby2.rb +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | if Rails::VERSION::MAJOR == 2 && RUBY_VERSION >= '2.0.0' | ||
| 2 | module ActiveRecord | ||
| 3 | module Associations | ||
| 4 | class AssociationProxy | ||
| 5 | def send(method, *args) | ||
| 6 | if proxy_respond_to?(method, true) | ||
| 7 | super | ||
| 8 | else | ||
| 9 | load_target | ||
| 10 | @target.send(method, *args) | ||
| 11 | end | ||
| 12 | end | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| 16 | end | ||
