I created a engine that provides the ui component as a cell. The corresponding gem ( criteria_operator-ui_component ) almost does not contain code inside the lib folder, because in order to work correctly I had to work inside the asset path. The main gem file looks like this:
require 'criteria_operator/ui_component/engine' require 'cells/rails' module CriteriaOperator module UiComponent
The engine does not contain a large amount:
module CriteriaOperator module UiComponent class Engine < ::Rails::Engine require 'jquery-rails' require 'criteria_operator' isolate_namespace CriteriaOperator::UiComponent end end end
It seems to me that the stone cannot even know about the cell, but as far as I know, I am not allowed to include anything from the lib folder. In addition, testing a cell in a dummy application inside a project works fine.
Now I use this engine inside a real Rails application. In gemfile, I included the following:
gem 'criteria_operator' gem 'cells'
I set the routes
mount CriteriaOperator::UiComponent::Engine => '/criteria_operator-ui_component'
and tried to use the cell CriteriaOperator::UiComponent::CriteriaEditor , as I did in the dummy application. Inside erb:
cell('criteria_operator/ui_component/criteria_editor', @op)
or from code:
include Cell::RailsExtensions::ActionController def whatever cell(CriteriaOperator::UiComponent::CriteriaEditor, @op).call() end
Error ActionView::Template::Error (uninitialized constant CriteriaOperator::UiComponent::CriteriaEditor) .
What am I doing wrong? Am I just missing something when using the engine, or is the engine itself implemented incorrectly? And if so, why does the dummy application work? I'm completely stuck, this is my first time creating a Rails Engine, as well as my first time working with cells ...
The full engine code (including a dummy application) can be found on GitHub (this should not be any advertising, just in case someone needs additional information).