How to automatically reload changes in the Rails Engine?

I have a Rails 4.1.0 mounted engine. In the application_helper.rb engine:

module MyEngine module ApplicationHelper def test123 "test123" end end end 

This method is in the "dummy app view" general/index.html.erb :

 %<= test123 %> 

It works. However, when I change the line returned by def test123 and update the browser, a new line is not displayed.

Of course, restarting the web server in a dummy application shows a new line.

So, the question is how to reload engine files without restarting the web server?

PS. I prefer a way to do this using Rails on my own or a specific gem that solves this problem (but not common gems like Guard, Spork, etc., although if all else fails, I will consider them too.)

SFC. There are similar questions on SO, but I tried all of them (even if they are designed for Rails 2.x, 3.x), and they did not work for me.

+7
ruby-on-rails-4 rails-engines
Nov 24 '13 at 7:14
source share
2 answers

You must explicitly request dependent helpers:

 # engines/my_engine/app/controllers/my_engine/application_controller.rb require_dependency "my_engine/application_helper" # This is a key point! module MyEngine class ApplicationController < ::ApplicationController helper ApplicationHelper ... 
+2
Oct 29 '14 at 14:32
source share

you can use something like zeus , which helps a lot in viewing project files for changes, except when you change the configuration files do not work and must be manually reloaded.

but in most cases it works more than surprisingly

0
Dec 12 '13 at 16:59
source share



All Articles