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

Handlebars: View methods not called #34

Open
apauly opened this issue Jan 21, 2014 · 5 comments
Open

Handlebars: View methods not called #34

apauly opened this issue Jan 21, 2014 · 5 comments

Comments

@apauly
Copy link

apauly commented Jan 21, 2014

When using mustache, I can directly call methods from the View class inside of a template:

module Layouts
  class Application < ::Stache::Mustache::View
    def page_title
      "Test"
    end
  end
end
<h1>{{page_title}}</h1>

This results to:

<h1>Test</h1>

When using handlebars, this methods are not called:

module Layouts
  class Application < ::Stache::Handlebars::View
    def page_title
      "Test"
    end
  end
end
<h1>{{page_title}}</h1>

This results to:

<h1></h1>

The expected behaviour is to render the same as the mustache version.

@hypomodern
Copy link
Contributor

Could I trouble you to write a failing test case for this? I'll take a look at it, but we do have a test that would seem to cover this case already:

https://github.com/agoragames/stache/blob/master/spec/controllers/handlebars_controller_spec.rb#L18
https://github.com/agoragames/stache/blob/master/spec/dummy/lib/wrapper/handlebars/with_wrapper.rb

I'll try to reproduce on my own time soon, too, but with a failing test that will happen more quickly :). Cheers!

@apauly
Copy link
Author

apauly commented Jan 23, 2014

I've been digging a bit through the sources of stache and handlebars. It seems that handlebars-0.5.0 does not implement "helperMissing".

I was using stache v1.0.3 with Rails 3 and Ruby 1.9.3.

However, when I try to use version '0.4.0' with handlebars 0.4.0 I am getting an exception cannot load such file -- v8/init. Still trying to resovle the issue...

@czarneckid
Copy link
Member

Related? cowboyd/handlebars.rb#17

@hypomodern
Copy link
Contributor

@czarneckid definitely looks like it could be. I'll have to look at handlebars-0.5.0 this weekend.

@devknoll
Copy link

devknoll commented Nov 7, 2014

Ran into this today. It's a regression in Handlebars 1.3.0. Handlebars.rb would need to be updated to the 2.0 handlebars-source gem.

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

4 participants