Upgrading my gem "polaris_view_components" from version "~> 1.2.0
to "2.0.0"
Gemfile
gem 'polaris_view_components', '~> 2.0', '>= 2.0.1'
gem "view_component"
Bundling gems was successful...
gem list polaris_view_components
*** LOCAL GEMS ***
polaris_view_components (2.2.4)
But I cannot start the application, the error shows
Unable to load application: NameError: uninitialized constant Polaris::ViewHelper
There is NO trace of Polaris::ViewHelper
in my source code (i don't include it manually).
It came from gem generated files (in the bottom part it contains helper Polaris::ViewHelper
)
/Users/developer/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/polaris_view_components-2.0.0/lib/polaris/view_components/engine.rb:36
Here is the file engine.rb
require "rails/engine"
require "view_component"
require "view_component/version"
module Polaris
module ViewComponents
class Engine < ::Rails::Engine
isolate_namespace Polaris::ViewComponents
config.autoload_paths = %W[
#{root}/app/components
#{root}/app/helpers
]
# Remove default wrapping .field_with_errors for proper Shopify form validations
config.to_prepare do
ActionView::Base.field_error_proc = ->(html_tag, _instance) { html_tag.html_safe }
end
initializer "polaris_view_components.assets" do |app|
if app.config.respond_to?(:assets)
app.config.assets.precompile += %w[
polaris_view_components.js polaris_view_components.css
]
end
end
initializer "polaris_view_components.importmap", before: "importmap" do |app|
if app.config.respond_to?(:importmap) && app.config.importmap.has_key?(:cache_sweepers)
app.config.importmap.cache_sweepers << Engine.root.join("app/assets/javascripts")
end
end
initializer "polaris_view_components.helpers" do
ActiveSupport.on_load(:action_controller_base) do
helper Polaris::ViewHelper
helper Polaris::UrlHelper
end
end
end
end
end
Upgrading my gem "polaris_view_components" from version "~> 1.2.0
to "2.0.0"
Gemfile
gem 'polaris_view_components', '~> 2.0', '>= 2.0.1'
gem "view_component"
Bundling gems was successful...
gem list polaris_view_components
*** LOCAL GEMS ***
polaris_view_components (2.2.4)
But I cannot start the application, the error shows
Unable to load application: NameError: uninitialized constant Polaris::ViewHelper
There is NO trace of Polaris::ViewHelper
in my source code (i don't include it manually).
It came from gem generated files (in the bottom part it contains helper Polaris::ViewHelper
)
/Users/developer/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/polaris_view_components-2.0.0/lib/polaris/view_components/engine.rb:36
Here is the file engine.rb
require "rails/engine"
require "view_component"
require "view_component/version"
module Polaris
module ViewComponents
class Engine < ::Rails::Engine
isolate_namespace Polaris::ViewComponents
config.autoload_paths = %W[
#{root}/app/components
#{root}/app/helpers
]
# Remove default wrapping .field_with_errors for proper Shopify form validations
config.to_prepare do
ActionView::Base.field_error_proc = ->(html_tag, _instance) { html_tag.html_safe }
end
initializer "polaris_view_components.assets" do |app|
if app.config.respond_to?(:assets)
app.config.assets.precompile += %w[
polaris_view_components.js polaris_view_components.css
]
end
end
initializer "polaris_view_components.importmap", before: "importmap" do |app|
if app.config.respond_to?(:importmap) && app.config.importmap.has_key?(:cache_sweepers)
app.config.importmap.cache_sweepers << Engine.root.join("app/assets/javascripts")
end
end
initializer "polaris_view_components.helpers" do
ActiveSupport.on_load(:action_controller_base) do
helper Polaris::ViewHelper
helper Polaris::UrlHelper
end
end
end
end
end
Share
Improve this question
edited Nov 20, 2024 at 2:09
aldrien.h
asked Nov 20, 2024 at 0:32
aldrien.haldrien.h
3,6353 gold badges34 silver badges58 bronze badges
1 Answer
Reset to default 0Looks like the latest version of this gem is for Rails 7.1 or higher https://github/baoagency/polaris_view_components/pull/338/files
Also needs higher than ruby 3.1 - at least on my testing locally.