787 questions
3
votes
1
answer
718
views
Importmap Rails and Stimulus when working with Rails Engines
I'm unable to get stimulus and importmaps to read files from an app engine. The current project I've been tasked to do involves me upgrading all legacy engines to use importmaps and stimulus JS. The ...
1
vote
1
answer
115
views
Sprockets::Rails::Helper::AssetNotPrecompiledError in MyEngine::Frontend#new
Asset hero_banner.jpg was not declared to be precompiled in production.
Declare links to your assets in app/assets/config/manifest.js.
//= link hero_banner.jpg
Rails.application.config.assets.paths &...
1
vote
1
answer
80
views
MyEngine::FrontendController#index is missing a template for request formats: text/html render different layout from controller
Layouts are present in app/apps/themes/default_theme/views/layouts
I have a frontend controller that renders layouts of different themes based on params. For now , lets assume it renders default_theme....
1
vote
1
answer
240
views
How to load gem's Railites only after all config/initializers load?
I have a gem which conditionally loads RailsWarden::Manager, based on a flag in the config/initializers/mygem.rb file:
module Mygem
class Railtie < Rails::Railtie
initializer "...
5
votes
1
answer
353
views
Rails 7 way of auto-loading methods into controllers via engine
I'm looking into updating one of my favorite CMSs to Rails 7 that have been archived on github (PushType). Only I haven't coded Rails since Rails 6. Apparently, something about autoloading methods ...
0
votes
2
answers
138
views
ActiveAdmin in rails engine give me that error : uninitialized constant MyEngine::Admin
I installed activeadmin in a rails engine that I mounted in my main application. When I try to access the home page I get the following error: uninitialized constant BackOffice::Admin
The code in lib/...
11
votes
2
answers
4k
views
`FrozenError: can't modify frozen Array` in Rails 7 Engine when running `rspec`
I just upgraded an Engine from Rails 5 to Rails 7. This error started appearing at Rails 6.1.7.6, but I thought perhaps it might've been fixed in Rails 7.
Here's the error I get when I run rspec
An ...
2
votes
0
answers
198
views
Inflections: How to use custom acronyms when creating new application
Let’s say I’m working on a product called Friendly Organizational Operator, for which we use FOO as the acronym. I want to create a new engine to encapsulate a particular piece of functionality we’ll ...
0
votes
1
answer
446
views
How do I configure the load order of Rails engines?
I have a Rails application that is using multiple gems. Each gem provides assets, that are added to the Rails asset path:
main app
admin engine with customised forms
wysiwyg engine
I want to ...
3
votes
1
answer
1k
views
Run tests located in a Rails Engine when mounted in host application
I have some tests located in an engine called "Blorgh". I simply test my engine by running the following command in the root directory of my engine's repository.
rails test
...
19 runs, 8 ...
2
votes
1
answer
2k
views
Rails 7 engine how to make uncompiled stylesheets available to host app?
So I have a file not found problem.
I have an engine that works in development mode in the engines test/dummy app, the engine allows the editing of sass variables and stores them in a theme table, the ...
10
votes
2
answers
3k
views
How to use tailwind css gem in a rails 7 engine?
How to use tailwind in a rails engine? According to the documentation supplying a css argument to the Rails generator should work
Rails 7.0.2.2 engine generated using
rails plugin new tailtest --...
0
votes
1
answer
330
views
Can't mount newly generated Rails engine in an app
I have a complex Rails app and I want to extract some core functionality into an engine so that I can reuse the models etc in other Rails apps.
I've been following the official documentation for ...
12
votes
2
answers
9k
views
How to set up importmap-rails in Rails 7 engine?
I have opened an issue in the importmap-rails gem github repository here about this but thought I'd throw the question out here in case anyone might have a workaround
This is what I have discovered so ...
1
vote
0
answers
361
views
Error while running rake zeitwerk:check in a model by inheriting a class from a rails engine as a gem in Rails 6 app using Zeitwerk Loader
I am using a Rails Engine as a Gem in my Rails Application. Now I have inherited a class from the rails engine in a model of my rails app.
1. Rails App Model Code
class AppModelOne < EngineGem::...
0
votes
1
answer
303
views
Error in rake app:assets:precompile when using a bootstrap sass variable in a rails engine
I am working on a rails engine which includes bootstrap-sass. I am trying to use a bootstrap variable in my styles, but I'm getting an error. I am trying to follow the documentation here:
https://www....
2
votes
1
answer
495
views
Rails: Belongs_to and Has_many associations in Rails Engines
So I building an application using Rails 6. I have implemented some core features of the app using Rails Engines.
The name of the Engine Baseblog, and I have 2 models for it called Author and Post.
An ...
1
vote
1
answer
188
views
Associations within Rails Engine not working
I'm building my first Rails engine and getting pretty confused already defining the associations between two models. For the reason of ease, let's say the name of the engine is Blorg, having two ...
1
vote
0
answers
958
views
How can I add a custom rake task to my engine?
I am writing an engine and I want to include a task in it.
I wrote my file .rake, bus it isn't listed with rake --task. If I try to run int anyway I get:
❯ rake what2find:index
rake aborted! Don't ...
1
vote
0
answers
171
views
How do I can load rails engine webpacker compiled js file inside rails application on webpacker:compile
I'm using a rails engine with webpacker and compiling it inside my rails application but I need to copy paste copiled engine manifest.json file inside webpacker:compile manifest.json. I want to load a ...
1
vote
0
answers
199
views
Rails engine testing controller using helper method of main app in rspec
I have one main rails app, and I have an engine within it, now the engine has a different test, I need to test one controller which is using main app MailerHelper module. How can I access in my spec.
...
0
votes
1
answer
112
views
Moving route from Rails Application to Rails Engine gem
I'm working on a project where I have a Rails application (rails 4.2.5) that incorporates a gem, which is a Rails Engine. I'm currently working on moving the route definitions from the main ...
0
votes
2
answers
1k
views
How to mock a GraphQL type in Rails engine rspec?
I'm working inside a Rails engine where I have a GraphQL type.
module RailsEngine
module Graph
module RailsEngine
module Types
MyClass = GraphQL::ObjectType.define do
# ...
0
votes
1
answer
411
views
Debugging Resque::Server
We have two Rails applications using Resque and Redis. Resque and Redis are configured identically on both apps, which are both using Rails 4.2 and Resque 1.27.4.
However, the availability of Resque ...
1
vote
0
answers
501
views
Rails, how to remove a directory from eager load paths
I see lots of instructions on how to add a directory to Rails eager load paths and auto load paths, but none on how to remove a directory.
Here's my problem. I've inherited a project with extremely ...