Closed clinejj closed 2 years ago
We have a class with the following definition:
# == Schema Information # # Table name: product_filters # # id :bigint not null, primary key # display_text_key :string # filter_type :integer default("select_multiple") # created_at :datetime not null # updated_at :datetime not null # # Indexes # # index_product_filters_on_display_text_key (display_text_key) UNIQUE # class ProductFilter < ApplicationRecord enum filter_type: { select_multiple: 0, select_single: 1, range: 2, text: 3 }, _default: :select_multiple end
when running bin/rails rbs_rails:all --trace we get the following error:
bin/rails rbs_rails:all --trace
** Invoke rbs_rails:all (first_time) ** Invoke rbs_rails:generate_rbs_for_models (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute rbs_rails:generate_rbs_for_models rails aborted! NoMethodError: undefined method `each' for :select_multiple:Symbol /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:246:in `block (2 levels) in enum_instance_methods' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:243:in `each' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:243:in `block in enum_instance_methods' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:242:in `each' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:242:in `enum_instance_methods' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:37:in `klass_decl' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:25:in `generate' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/active_record.rb:11:in `class_to_rbs' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/rake_task.rb:45:in `block (2 levels) in def_generate_rbs_for_models' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/rake_task.rb:38:in `each' /gem_cache/ruby/3.0.0/gems/rbs_rails-0.9.0/lib/rbs_rails/rake_task.rb:38:in `block in def_generate_rbs_for_models' /gem_cache/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
The task completes as expected if the _default option is commented out, like so:
_default
class ProductFilter < ApplicationRecord enum filter_type: { select_multiple: 0, select_single: 1, range: 2, text: 3 } #, _default: :select_multiple end
We have a class with the following definition:
when running
bin/rails rbs_rails:all --trace
we get the following error:The task completes as expected if the
_default
option is commented out, like so: