Questions tagged [rails-engines]

A Rails engine allows you to share common functionality across applications in the form of a gem or a plugin. Engines can be considered miniature applications that provide functionality to their host applications.

A Rails engine allows you to share common functionality across applications in the form of a gem or a plugin. Engines can be considered miniature applications that provide functionality to their host applications.

Check http://guides.rubyonrails.org/engines.html and http://railscasts.com/episodes/277-mountable-engines for more details.

762 questions
13
votes
0 answers

What is the best way to use webpacker in a Rails engine?

I realise there is some debate about using webpacker in Rails engines but I have a simple usecase and currently have a workaround. Would like to know of a better (the best?) solution. In this rails engine I have webpacker setup in the "spec/dummy"…
PropertyWebBuilder
  • 1,119
  • 2
  • 10
  • 15
13
votes
2 answers

Rails mountable engine with isolate_namespace but without prefixed namespace on tables

Is there a way to configure the isolate_namespace method to not use prefixed table names? class Engine < ::Rails::Engine isolate_namespace MyEngine end Additionally, an isolated engine will set its name according to namespace, so…
keaplogik
  • 2,128
  • 2
  • 21
  • 25
13
votes
1 answer

Add new migrations from Rails engine gem to app via generator

I'm building a Rails engine in a ruby gem. It includes some migrations right now that are called when you run: rails g myengine:install The code in the generator is as follows: module MyEngine module Generators class InstallGenerator <…
Jamon Holmgren
  • 20,854
  • 4
  • 52
  • 69
13
votes
1 answer

Rails engine / How to use seed?

I have created a Rails Engine. I am having trouble using the seed command, if I run rake db:seed I get the error: "uninitialized constant". In the engine, I got a seeds.rb: Page.create(:title => 'Frontpage', :order => '1') Then in my dummy app I…
jakobk
  • 1,102
  • 1
  • 14
  • 26
12
votes
2 answers

Can't run Rails in Gem/Engine project without first installing the gem itself

I just made a fresh checkout of my Rails Engine project, and when (after bundle install) I invoke rails -v in its root directory, I'm getting a LoadError in which Rails appears to be looking for the very gem/engine I'm trying to build: my-engine…
David Moles
  • 39,436
  • 24
  • 121
  • 210
12
votes
3 answers

Rails Engines: When to put code in app, when in lib, and when in vendor folder?

I'm developing a Rails engine, and so I've taken some looks on existing ones. I noticed that many of them have files in app, but also in lib and vendor. It's clear to me that I should put any code that should be replaceable by the host app into the…
Joshua Muheim
  • 10,965
  • 6
  • 61
  • 127
12
votes
2 answers

Rails Engines: Helpers only are reloaded when restarting the server

I'm currently experimenting with moving functionality into engines. It works nicely so far, but I'm a bit confused why certain parts of the engine are always automatically reloaded when something changed, and some are not. Specifically, when adding…
Joshua Muheim
  • 10,965
  • 6
  • 61
  • 127
12
votes
2 answers

Add asset path in rails mountable engine?

How can I add vendor/assets/javascripts/mymountableengine or vendor/assets/stylesheets/mymountableengine to my mountable engine's assets paths? I want to be able to require files from these folders in my mountable engine's…
Yeggeps
  • 1,965
  • 2
  • 21
  • 33
11
votes
4 answers

How do I make gemspec dependencies autoload in a Rails 3 app, using a Gemfile

I have a Rails 3 app that I am turning into a Rails engine / gem. This engine has some gem dependencies that I have put inside it's .gemspec file. I have created a new 'parent' Rails 3 app, and I would like to add my engine gem to the Gemfile and…
ndbroadbent
  • 12,589
  • 3
  • 53
  • 77
11
votes
2 answers

rails 3 blog engine/gem that works on heroku, what to use?

I have spent some time looking for a rail3 blog engine for use on an existing site. I want the blog on the same domain as the application for SEO points eg www.site.com/blog not blog.site.com Having spent some time on this I have…
Ed_
  • 1,402
  • 2
  • 11
  • 21
11
votes
1 answer

Sharing a mongoid model between 2 applications - using engine vs. plugin

I want to share a model between 2 (maybe more in the future) of my rails apps. I couldn't find any clear suggestions, but I picked up some of the questions and answers I've read and came to a conclusion that it has to be done with a "gemmed" plugin…
benams
  • 3,564
  • 9
  • 28
  • 64
11
votes
1 answer

How to render a Rails engine's views inside the host app

I need some help getting a rails engine to communicate with my host application. I've got a standard layout file in the engine. app/views/layouts/my_engine/application.html.erb and my host app has the…
Ben Downey
  • 2,213
  • 4
  • 30
  • 53
11
votes
6 answers

Rails Engine + Mongoid: No configuration could be found for a session named 'default'

I've created a Rails Mountable App and added 'mongoid' and 'rspec' gem's. If I try to run my specs now I get the following error: Mongoid::Errors::NoSessionConfig: Problem: No configuration could be found for a session named 'default'. Summary: …
wintersolutions
  • 4,855
  • 5
  • 28
  • 48
10
votes
1 answer

Can a Rails 3 engine access models from it's parent application?

I have a Rails Engine and I want to access the parents models. Is that possible? If so, how would I do it?
Shamoon
  • 33,919
  • 63
  • 225
  • 452
10
votes
6 answers

Ruby on Rails 3.1 Blog Engines

I see a lot of people asking about Blog Engines, but most of the questions & answers are rather old. Or if they aren't old most of the projects are old. I'm wondering if anyone knows of any Blog Engines that currently support Rails 3.1 or are at…
JDutil
  • 3,542
  • 22
  • 31
1 2
3
50 51