Reputation: 688
I'd like to have my controller render json views, as .json.haml ... is this possible? What is the syntax like? Or would I need to use something else for JSON templating? such as http://inem.github.com/tequila.html?
Upvotes: 1
Views: 3358
Reputation: 25761
HAML is intented for use to generate HTML markup.
If you need to render json, just call render
passing :json
as an option within your controller:
render :json => my_object
Or if you have a more complex data structure and/or require more flexibility try JSON Builder, it's a template engine for JSON, similar to the XML builder provided in Rails.
Upvotes: 1