Reputation: 119
I'm writing an app using marionette js and using rails as my server side. To handle my templates I'm using the handlebars gem (.hambars to write templates in haml) and I think I'm having an issue with the rails asset pipeline?
My templates folder is in my assets/javascripts folder with the rest of my marionette stuff. I had written much of this app is straight rails before trying to transition to client side rendering, and I have a form that I'm trying to render.
in HTML I used the rails form builder <%= form_for .... %> and everything worked as expected. but as soon as I put this form in the templates folder as a part of a hamlbars template I get an error saying "undefined method form_for" I've also noticed that I can't use any of my routes helpers such as "posts_path" in these templates. my haml is correct it's not a syntax problem has anyone had experience with something like this before??
Upvotes: 0
Views: 156
Reputation: 119
So it turns out hamlbars is completely client side and rails never gets a chance to compile it server side. there is a handlebars assets gem that is supposed to smooth out these problems, but it didn't in this case. I will report this as an issue.
As a workaround, I made a jquery request and rendered a rails form through my rails controller/js file server side. Just in case anyone had the same problem!
Upvotes: 1