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

Fix: Define default_strict_value before it's called #793

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

bedgerotto
Copy link
Contributor

Flipper fails to load due to missing method default_strict_value

/Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.2/lib/rails/railtie.rb:228:in `method_missing': undefined local variable or method `default_strict_value' for Flipper::Engine:Class (NameError)
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/flipper-1.1.2/lib/flipper/engine.rb:13:in `block in <class:Engine>'

Moving the method to the top of the class (before it's used) solves the problem.

Tested on a brand new rails project
Rails 7.1.2
Ruby 3.2.2

Gemfile:

gem "flipper", "~> 1.1", require: false
gem "flipper-redis", require: false
gem "flipper-ui", require: false

flipper initializer:

require "flipper"
require "flipper/adapters/redis"
require "flipper/adapters/instrumented"

Flipper.configure do |config|
  config.default do
    redis_config = Rails.application.config_for("redis-pool").symbolize_keys
    connection = Redis.new(redis_config)
    adapter = Flipper::Adapters::Redis.new(connection)
    instrumented = Flipper::Adapters::Instrumented.new(
      adapter, instrumenter: ActiveSupport::Notifications
    )

    Flipper.new(instrumented, instrumenter: ActiveSupport::Notifications)
  end
end

@jnunemaker jnunemaker merged commit f6f819a into flippercloud:main Dec 16, 2023
32 checks passed
@jnunemaker
Copy link
Collaborator

If you don't mind, I would love to know what you are using flipper for as well and how it is working out for you (what went well, what was hard other than what you mentioned here).

If you aren't comfortable leaving that information here in a public comment, feel free to email me directly john@fewerandfaster.com. I'm just always curious. :)

@bedgerotto
Copy link
Contributor Author

@jnunemaker any chance we can have a new release with this fix? Or is there any scheduled release for the next few days/weeks?

Thank you very much 🙇🏼

@bkeepers
Copy link
Collaborator

@bedgerotto 1.2.0 is out with this fix. Thanks for your help! https://blog.flippercloud.io/flipper-1-2-0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants