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

Templates not running in production #65

Open
SampsonCrowley opened this issue May 29, 2018 · 10 comments
Open

Templates not running in production #65

SampsonCrowley opened this issue May 29, 2018 · 10 comments

Comments

@SampsonCrowley
Copy link

I cannot for the life of me figure out why, by my templates that work perfectly in development are never called in production. somehow the template is still being rendered but all variables are blank and puts statements that I put in the methods are never called in production

@SampsonCrowley
Copy link
Author

From what I can tell, the associated .rb file is never called whatsoever

@SampsonCrowley
Copy link
Author

I'm really tearing my hair out with this one...

@t-okamoto19
Copy link

t-okamoto19 commented Jul 20, 2018

I'm in a similar situation😞
@SampsonCrowley
Did you able to resolve?

@rwd
Copy link
Contributor

rwd commented Jul 20, 2018

I experienced a similar problem but only in Rails 5, whereas it was fine in Rails 4.

To get around this, I have our .html.mustache Mustache templates in app/views, but the .rb class files in app/presenters, then in an initializer:

ApplicationController.view_paths = ApplicationController.view_paths.reject do |path|
  path.to_s == Rails.root.join('app', 'views').to_s
end

Stache.configure do |c|
  c.use :mustache
  c.template_base_path = ::Rails.root.join('app', 'views')
end

@t-okamoto19
Copy link

@rwd
Thank you for your reply!
but not working 😢
which version of stache do you use?

stache (1.2.0)

@rwd
Copy link
Contributor

rwd commented Jul 20, 2018

@t-okamoto19 ah, shame :(

stache 1.2.0 and mustache 1.0.3 here.

@t-okamoto19
Copy link

t-okamoto19 commented Jul 20, 2018

@rwd
our .rb class files is here. 'app/views/layouts'
is it cause of problem?
im working on upgrading rails4.1 to rails5.2.

@rwd
Copy link
Contributor

rwd commented Jul 20, 2018

@t-okamoto19 as I mentioned above, I needed to move the .rb files into a different directory from the .html.mustache files, e.g.

  • app/presenters/records/show.rb
  • app/views/records/show.html.mustache

@t-okamoto19
Copy link

@rwd
thanks!
I'll try later and share the results.

@SampsonCrowley
Copy link
Author

SampsonCrowley commented Jul 20, 2018

@t-okamoto19 no I don't think that I did. I decided this repo wasn't worth using since the devs don't seem to care about user issues (notice you're the first reply since I opened the issue 2 MONTHS ago)

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

No branches or pull requests

3 participants