I have this but I'm pretty sure that is not the best way to build it up.
var dogs = {
'names' : ["a", "b", "c"],
'images': [
<% @dogs.images.each do |image| %>
{
'thumb' : '<%= image.thumb %>',
'medium' : '<%= image.medium %>',
} <%= "," unless(@dogs.images.last.id == image.id) %>
<% end %>
]
}
Thanks for your help!