Cannot use cells from engine inside Rails application

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 # Your code goes here... end end 

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 added these three, because `bundler list` didn't show me gem 'cells-rails' # `cells-rails` and `cells-erb` even though they are listed gem 'cells-erb' # as dependencies for the engine gem 'criteria_operator-ui_component' 

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).

+8
ruby-on-rails rails-engines rails-cells
source share

No one has answered this question yet.

See related questions:

37
Testing Rails 3.1 mounted engine with RSpec
3
Hook Rails engine in global layout
2
How to get Devise current_user method in Rails Engine
one
Rails3.1 engine: cannot force SLIM or HAML to work in a test / dummy application
one
Haml rails do not work in Rails 3 Engine
one
How to run "new rails .." from inside the engine
0
The Rails 4 nested module module is not included in an uninitialized constant (NameError)
0
Rails Engine cannot find templates
0
How to create a migration inside the db / migrate folder on the Rails personal engine
0
Unable to access model from inside ActionController method added by Rails engine

All Articles