lib/rails/generators/component/component_generator.rb in view_component-2.65.0 vs lib/rails/generators/component/component_generator.rb in view_component-2.66.0
- old
+ new
@@ -11,15 +11,16 @@
argument :attributes, type: :array, default: [], banner: "attribute"
check_class_collision suffix: "Component"
class_option :inline, type: :boolean, default: false
- class_option :locale, type: :boolean, default: ViewComponent::Base.generate.locale
+ class_option :locale, type: :boolean, default: Rails.application.config.view_component.generate.locale
class_option :parent, type: :string, desc: "The parent class for the generated component"
- class_option :preview, type: :boolean, default: ViewComponent::Base.generate.preview
+ class_option :preview, type: :boolean, default: Rails.application.config.view_component.generate.preview
class_option :sidecar, type: :boolean, default: false
- class_option :stimulus, type: :boolean, default: ViewComponent::Base.generate.stimulus_controller
+ class_option :stimulus, type: :boolean,
+ default: Rails.application.config.view_component.generate.stimulus_controller
def create_component_file
template "component.rb", File.join(component_path, class_path, "#{file_name}_component.rb")
end
@@ -38,10 +39,10 @@
private
def parent_class
return options[:parent] if options[:parent]
- ViewComponent::Base.component_parent_class || default_parent_class
+ Rails.application.config.view_component.component_parent_class || default_parent_class
end
def initialize_signature
return if attributes.blank?