Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branded views not used in rails daemon mode #2779

Closed
nicolasfranck opened this issue Jan 13, 2021 · 1 comment · Fixed by #2780
Closed

Branded views not used in rails daemon mode #2779

nicolasfranck opened this issue Jan 13, 2021 · 1 comment · Fixed by #2780
Assignees
Labels

Comments

@nicolasfranck
Copy link
Contributor

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

3.0.1

Expected behaviour:

When you startup rails in daemon mode,
the application should use the branded views:

bin/rails server -d

Actual behaviour:

In rails daemon mode, the branded views are discarded.

Steps to reproduce:

bin/rails server -d

However, if you start the application like this,

puma -d

then the branded views are used again.

@briri
Copy link
Contributor

briri commented Jan 13, 2021

Weird! I am able to reproduce this as well.

The code that tells the Rails engine to look in the branded folder first is in the base ApplicationController.rb,

prepend_view_path "app/views/branded"
.

I did some debugging and can see that when running in Daemon mode it loses the context of Rails.root for some reason:

# NON-DAEMONIZED (When running as `rails s`)
# -------------------------------------------------------
@paths=[
  "/Users/me/Documents/workspace/dmptool/app/views/branded", 
  "/Users/me/Documents/workspace/dmptool/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/kaminari-core-1.2.1/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contact_us-1.2.0/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/devise_invitable-2.0.3/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/devise-4.7.3/app/views"
]

# DAEMONIZED (when running as `rails s -d`)
# -------------------------------------------------------
@paths= [
  "/app/views/branded",
  "/Users/me/Documents/workspace/dmptool/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/kaminari-core-1.2.1/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/contact_us-1.2.0/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/devise_invitable-2.0.3/app/views", 
  "/Users/me/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/devise-4.7.3/app/views"
]

I'm guessing its related to this change to ActionView::PathSet but am not sure.

Updating the line in ApplicationController.rb to prepend_view_path Rails.root.join("app", "views", "branded") fixes the issue. I will submit a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants