Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Rails global constant #761

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/flipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ def groups_registry=(registry)
require 'flipper/typecast'
require 'flipper/version'

require "flipper/engine" if defined?(Rails)
require "flipper/engine" if defined?(::Rails)
2 changes: 1 addition & 1 deletion lib/flipper/cloud/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Rails.application.routes.draw do
if ENV["FLIPPER_CLOUD_TOKEN"] && ENV["FLIPPER_CLOUD_SYNC_SECRET"]
require 'flipper/cloud'
config = Rails.application.config.flipper
config = ::Rails.application.config.flipper

cloud_app = Flipper::Cloud.app(nil,
env_key: config.env_key,
Expand Down
2 changes: 1 addition & 1 deletion lib/flipper/engine.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Flipper
class Engine < Rails::Engine
class Engine < ::Rails::Engine
paths["config/routes.rb"] = ["lib/flipper/cloud/routes.rb"]

config.before_configuration do
Expand Down
2 changes: 1 addition & 1 deletion lib/flipper/instrumentation/log_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def logger

# Rails 7.1 changed the signature of this function.
# Checking if > 7.0.99 rather than >= 7.1 so that 7.1 pre-release versions are included.
COLOR_OPTIONS = if Rails.gem_version > Gem::Version.new('7.0.99')
COLOR_OPTIONS = if ::Rails.gem_version > Gem::Version.new('7.0.99')
{ bold: true }.freeze
else
true
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/flipper/active_record_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def self.next_migration_number(dirname)
end

def self.migration_version
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if requires_migration_number?
"[#{::Rails::VERSION::MAJOR}.#{::Rails::VERSION::MINOR}]" if requires_migration_number?
end

def self.requires_migration_number?
Rails::VERSION::MAJOR.to_i >= 5
::Rails::VERSION::MAJOR.to_i >= 5
end

def create_migration_file
Expand Down