rubyworks / facets

Ruby Facets
http://rubyworks.github.com/facets
Other
798 stars 99 forks source link

Rails console broken #292

Open trishtzy opened 4 years ago

trishtzy commented 4 years ago
hotel_app [master~1●] % bundle exec rails c
Traceback (most recent call last):
    61: from bin/rails:9:in `<main>'
    60: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require'
    59: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency'
    58: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require'
    57: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    56: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    55: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    54: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    53: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    52: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/commands.rb:18:in `<main>'
    51: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/command.rb:46:in `invoke'
    50: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/command/base.rb:69:in `perform'
    49: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
    48: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
    47: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
    46: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/commands/console/console_command.rb:101:in `perform'
    45: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
    44: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/command/actions.rb:22:in `require_application!'
    43: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require'
    42: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency'
    41: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require'
    40: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    39: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    38: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    37: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    36: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    35: from /hotel/hotel_app/config/application.rb:22:in `<main>'
    34: from /hotel/hotel_app/config/application.rb:23:in `<module:HotelApp>'
    33: from /hotel/hotel_app/config/application.rb:25:in `<class:Application>'
    32: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/railtie.rb:127:in `config'
    31: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/application.rb:100:in `instance'
    30: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/railtie.rb:167:in `instance'
    29: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/railtie.rb:167:in `new'
    28: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/railties-6.0.3/lib/rails/application.rb:139:in `initialize'
    27: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require'
    26: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency'
    25: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require'
    24: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    23: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    22: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    21: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    20: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    19: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/executor.rb:3:in `<main>'
    18: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require'
    17: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency'
    16: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require'
    15: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    14: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    13: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    12: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    11: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    10: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:6:in `<main>'
     9: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:7:in `<module:ActiveSupport>'
     8: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/execution_wrapper.rb:14:in `<class:ExecutionWrapper>'
     7: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:816:in `define_callbacks'
     6: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:816:in `each'
     5: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:819:in `block in define_callbacks'
     4: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:819:in `each'
     3: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:820:in `block (2 levels) in define_callbacks'
     2: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/callbacks.rb:849:in `set_callbacks'
     1: from /hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/core_ext/class/attribute.rb:106:in `block (2 levels) in class_attribute'
/hotel/hotel_app/vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/core_ext/module/redefine_method.rb:27:in `redefine_singleton_method': private method `redefine_method' called for #<Class:ActiveSupport::ExecutionWrapper> (NoMethodError)

Getting this error repeatedly when running bundle exec rails c. Did anyone encounter this before?

esparta commented 4 years ago

sorry, but how is this related to the facets project?

jerimiahmilton commented 4 years ago

I'm getting a similar issue, when trying to run tests.

root@f25c0324ad71:/app# bundle exec rake spec
/usr/local/bin/ruby -I/usr/local/bundle/gems/rspec-core-3.6.0/lib:/usr/local/bundle/gems/rspec-support-3.6.0/lib /usr/local/bundle/gems/rspec-core-3.6.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb

An error occurred while loading ./spec/acceptance/estimates_spec.rb.
Failure/Error: require "rspec/rails"

NoMethodError:
  private method `redefine_method' called for #<Class:ActionView::TestCase::TestController>
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/core_ext/module/redefine_method.rb:36:in `redefine_singleton_method'
# /usr/local/bundle/gems/actionpack-5.2.4.3/lib/action_dispatch/routing/route_set.rb:560:in `block (2 levels) in url_helpers'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/concern.rb:122:in `class_eval'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/concern.rb:122:in `append_features'
# /usr/local/bundle/gems/actionpack-5.2.4.3/lib/abstract_controller/railties/routes_helpers.rb:13:in `include'
# /usr/local/bundle/gems/actionpack-5.2.4.3/lib/abstract_controller/railties/routes_helpers.rb:13:in `block (2 levels) in with'
# /usr/local/bundle/gems/actionpack-5.2.4.3/lib/action_controller/railties/helpers.rb:7:in `inherited'
# /usr/local/bundle/gems/actionview-5.2.4.3/lib/action_view/test_case.rb:13:in `<class:TestCase>'
# /usr/local/bundle/gems/actionview-5.2.4.3/lib/action_view/test_case.rb:12:in `<module:ActionView>'
# /usr/local/bundle/gems/actionview-5.2.4.3/lib/action_view/test_case.rb:10:in `<top (required)>'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
# /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
# ./spec/rails_helper.rb:9:in `<top (required)>'
# ./spec/acceptance/estimates_spec.rb:3:in `require'
# ./spec/acceptance/estimates_spec.rb:3:in `<top (required)>'
CoderMiguel commented 2 years ago

Running into a similar issue when adding the Facets gem to an existing project.

When just adding the gem:

WARN: NoMethodError: private method `redefine_method' called for #<Class:ActiveModel::Error>

    singleton_class.redefine_method(method, &block)
                   ^^^^^^^^^^^^^^^^
Did you mean?  define_method
WARN: /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/core_ext/module/redefine_method.rb:27:in `redefine_singleton_method'
/usr/local/bundle/gems/activemodel-6.1.7/lib/active_model/error.rb:13:in `i18n_customize_full_message='
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute.rb:129:in `public_send'
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute.rb:129:in `block in class_attribute'
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute.rb:129:in `each'
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/core_ext/class/attribute.rb:129:in `class_attribute'

This is very similar to both of the errors listed above, just with a newer version of ActiveStorage.

observed by trishtzy

vendor/gem/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/core_ext/module/redefine_method.rb:27:in redefine_singleton_method': private methodredefine_method' called for # (NoMethodError)

observed by OBCENEIKON

NoMethodError: private method redefine_method' called for #<Class:ActionView::TestCase::TestController> /usr/local/bundle/gems/activesupport-5.2.4.3/lib/active_support/core_ext/module/redefine_method.rb:36:inredefine_singleton_method'

researching this error lead me to this issue and the suggestions here.

Applying the most recent suggestion, without cherry picking results in a different Active Support error:

/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attr_internal.rb:33:in `public_send': protected method `attr_reader' called for ActionView::Helpers::ControllerHelper:Module (NoMethodError)

       public_send("attr_#{type}", internal_name)
       ^^^^^^^^^^^
 Did you mean?  cattr_reader
                mattr_reader
                attr_setter
        from /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/core_ext/module/attr_internal.rb:33:in `attr_internal_define'

When cherry picking just "facets/string", this introduces an error with Active Admin:

WARN: NameError: wrong constant name stringSymbolOrProcSetting

      raise ArgumentError, "Unknown type: #{type}" unless ActiveAdmin.const_defined?(klass)
                                                                     ^^^^^^^^^^^^^^^
2022-10-19T20:15:16.800Z pid=37 tid=8el WARN: /usr/local/bundle/gems/activeadmin-2.10.1/lib/active_admin/dynamic_setting.rb:11:in `const_defined?'

when cherry picking "facets/string/snakecase", we are back to Active Support, but with a third error:

WARN: NameError: uninitialized constant ActionText::ContentHelper
2022-10-19T20:18:22.709Z pid=1 tid=8fd WARN: /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/inflector/methods.rb:288:in `const_get'
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/inflector/methods.rb:288:in `block in constantize'
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/inflector/methods.rb:284:in `each'