mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 14:58:05 -05:00
Merge pull request #5600 from heartcombo/rm-drop-support-to-old-rubies-and-rails
Drop support to EOL rubies and Rails
This commit is contained in:
@@ -22,10 +22,6 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
def unauthenticated
|
||||
if Devise::Test.rails5_and_up?
|
||||
render body: "unauthenticated", status: :unauthorized
|
||||
else
|
||||
render text: "unauthenticated", status: :unauthorized
|
||||
end
|
||||
render body: "unauthenticated", status: :unauthorized
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,18 +6,6 @@ class StreamingController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
render (Devise::Test.rails5_and_up? ? :body : :text) => 'Index'
|
||||
end
|
||||
|
||||
# Work around https://github.com/heartcombo/devise/issues/2332, which affects
|
||||
# tests in Rails 4.x (and affects production in Rails >= 5)
|
||||
def process(name)
|
||||
super(name)
|
||||
rescue ArgumentError => e
|
||||
if e.message == 'uncaught throw :warden'
|
||||
throw :warden
|
||||
else
|
||||
raise e
|
||||
end
|
||||
render body: 'Index'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,6 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
user = User.to_adapter.find_first(email: 'user@test.com')
|
||||
user.remember_me = true
|
||||
sign_in user
|
||||
render (Devise::Test.rails5_and_up? ? :body : :text) => ""
|
||||
render body: ""
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def update_form
|
||||
render (Devise::Test.rails5_and_up? ? :body : :text) => 'Update'
|
||||
render body: 'Update'
|
||||
end
|
||||
|
||||
def accept
|
||||
@@ -24,11 +24,11 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def exhibit
|
||||
render (Devise::Test.rails5_and_up? ? :body : :text) => current_user ? "User is authenticated" : "User is not authenticated"
|
||||
render body: current_user ? "User is authenticated" : "User is not authenticated"
|
||||
end
|
||||
|
||||
def expire
|
||||
user_session['last_request_at'] = 31.minutes.ago.utc
|
||||
render (Devise::Test.rails5_and_up? ? :body : :text) => 'User will be expired on next request'
|
||||
render body: 'User will be expired on next request'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,23 +33,12 @@ module RailsApp
|
||||
# config.assets.enabled = false
|
||||
|
||||
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
||||
rails_version = Gem::Version.new(Rails.version)
|
||||
if DEVISE_ORM == :active_record &&
|
||||
rails_version >= Gem::Version.new('4.2.0') &&
|
||||
rails_version < Gem::Version.new('5.1.0')
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
end
|
||||
|
||||
# This was used to break devise in some situations
|
||||
config.to_prepare do
|
||||
Devise::SessionsController.layout "application"
|
||||
end
|
||||
|
||||
# Remove the first check once Rails 5.0 support is removed.
|
||||
if Devise::Test.rails52_and_up? && !Devise::Test.rails6_and_up?
|
||||
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
|
||||
end
|
||||
|
||||
if Devise::Test.rails70?
|
||||
config.active_record.legacy_connection_handling = false
|
||||
end
|
||||
|
||||
@@ -19,30 +19,6 @@ module Devise
|
||||
def self.rails70?
|
||||
Rails.version.start_with? '7.0'
|
||||
end
|
||||
|
||||
def self.rails6_and_up?
|
||||
Rails::VERSION::MAJOR >= 6
|
||||
end
|
||||
|
||||
def self.rails52_and_up?
|
||||
Rails::VERSION::MAJOR > 5 || rails52?
|
||||
end
|
||||
|
||||
def self.rails52?
|
||||
Rails.version.start_with? '5.2'
|
||||
end
|
||||
|
||||
def self.rails51?
|
||||
Rails.version.start_with? '5.1'
|
||||
end
|
||||
|
||||
def self.rails5_and_up?
|
||||
Rails::VERSION::MAJOR >= 5
|
||||
end
|
||||
|
||||
def self.rails5?
|
||||
Rails.version.start_with? '5'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,13 +22,7 @@ RailsApp::Application.configure do
|
||||
# config.action_dispatch.rack_cache = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||
if Devise::Test.rails5_and_up?
|
||||
config.public_file_server.enabled = false
|
||||
elsif Rails.version >= "4.2.0"
|
||||
config.serve_static_files = false
|
||||
else
|
||||
config.serve_static_assets = false
|
||||
end
|
||||
config.public_file_server.enabled = false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
||||
@@ -16,16 +16,8 @@ RailsApp::Application.configure do
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
if Devise::Test.rails5_and_up?
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
|
||||
elsif Rails.version >= "4.2.0"
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
else
|
||||
config.serve_static_assets = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
end
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
superclass = ActiveRecord::Migration
|
||||
# TODO: Inherit from the 5.0 Migration class directly when we drop support for Rails 4.
|
||||
superclass = ActiveRecord::Migration[5.0] if superclass.respond_to?(:[])
|
||||
|
||||
class CreateTables < superclass
|
||||
class CreateTables < ActiveRecord::Migration[5.0]
|
||||
def self.up
|
||||
create_table :users do |t|
|
||||
t.string :username
|
||||
|
||||
Reference in New Issue
Block a user