agoragames / stache

mustache and handlebars template handling in Rails 3.x and Rails 4.x
https://rubygems.org/gems/stache
MIT License
166 stars 49 forks source link

Templates not running in production #65

Open SampsonCrowley opened 6 years ago

SampsonCrowley commented 6 years ago

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 commented 6 years ago

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

SampsonCrowley commented 6 years ago

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

t-okamoto19 commented 6 years ago

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

rwd commented 6 years ago

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 commented 6 years ago

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

stache (1.2.0)

rwd commented 6 years ago

@t-okamoto19 ah, shame :(

stache 1.2.0 and mustache 1.0.3 here.

t-okamoto19 commented 6 years ago

@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 commented 6 years ago

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

t-okamoto19 commented 6 years ago

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

SampsonCrowley commented 6 years ago

@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)