0

I'm starting to use gem jbuilder in a Rails 4 app.

If I create a view file called show.json.jbuilder in the sites folder, and the following url displays the json = localhost/sites.json

If I add a file called tree.json.builder to the same sites folder, what url can I use to display the json?

Thanks for the help!

Reddirt
  • 5,913
  • 9
  • 48
  • 126

1 Answers1

0

First, you'll want to make sure you have the route and controller action defined for tree.json.builder. For example, your route could be localhost/sites/:site_id/tree.json which could point to sites#tree (sites_controller, tree action) and display the relevant info in the jbuilder view. There is a number of ways you can go about this. I suggest reading through the Rails routes docs to get a better idea of what's possible.

vich
  • 11,836
  • 13
  • 49
  • 66