mountain_view icon indicating copy to clipboard operation
mountain_view copied to clipboard

Components not found in Rails Engine

Open AlbertoHdezCerezo opened this issue 6 years ago • 1 comments

Hi,

First of all thank you for this incredible gem! Recently I started working with Rails. I am developing a Rails APP which has a custom Engine mounted.

After generating a new component under the component folder of the engine app I tried to load my application, and got this error message:

Missing partial wiki/_wiki with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby]}. Searched in:
  * "/opt/project/app/views"
  * "/usr/local/bundle/gems/mountain_view-0.13.0/app/views"
  * "/opt/project/engines/handover/app/views"
  * "/usr/local/bundle/gems/kaminari-core-1.1.1/app/views"
  * "/opt/project/app/components"

I understand the system is not being able to find the component because it is located under /opt/project/app/engines/<engine_name>/components.

How can I specify this route so the components are found?

AlbertoHdezCerezo avatar Dec 11 '18 12:12 AlbertoHdezCerezo

Oh, this is a very good question. And thanks for the kind words!

MountainView supports a components_path configuration option:

#config/initializers/mountain_view.rb

MountainView.configure do |config|
  config.components_path = Rails.root.join("path/to/components")
end

Unfortunately, that's only one path, so if you have multiple component directories (like /app/components and /app/engines/<engine>/components that won't work.

It's a neat idea and happy to receive a PR if you want to work on it. It may not be that straightforward though as it's used in several places.

kitop avatar Dec 11 '18 21:12 kitop