railsware / sht_rails

Shared handlebars templates for Rails 3
http://blog.railsware.com/2012/05/21/shared-handlebars-templates-for-rails-3/
MIT License
76 stars 21 forks source link

Add partial example to documentation #26

Open waynebontrager opened 9 years ago

waynebontrager commented 9 years ago

I was running into issues where the handlebars partials inside of a handlebars template was not able to find the files when rendering the template from Rails but it was working when using Javascript. I found from an example site (github: https://github.com/le0pard/st_rails_example, website: http://st-rails-example.herokuapp.com/) that this was the format I should be using:

<%= render "sht/product", handlebars: product_for_template(product), partials: {product_description: (render "sht/product_description")} %>

I didn't know partials was an option that could be passed so I thought it may be helpful for someone in the future to add this to the documentation somewhere.

le0pard commented 9 years ago

Hello, @waynebontrager You can send me PR for README fixes about this issue in docs :)

brunohstein commented 8 years ago

Is it possible to pass variables to the partials?

Also, there is no way to use partials inside the templates without passing them in the render partials option?