Wcrousse
Wcrousse

Reputation: 203

Trouble accessing rails generated json file

I have a rails application which displays a list of places that belong to a category selected by the user. The controller's index method contains the following relavent code:

@pois = PoiCategory.find(params[:id]).pois.order("name")  
@json = @pois.to_gmaps4rails do |poi, marker|
   marker.infowindow render_to_string(:partial => "/pois/infowindow", 
   :locals => {:poi => poi})
   marker.title "#{poi.name}"
   marker.json({ :name => poi.name })
end
respond_to do |format|
  format.html # index.html.erb
  format.json { render json: @pois }
end

end

the url for this page ends, host/pois?id=x, where x is some integer in the set of category ids. As I understand it, the address of json file the should just have, ".json" added to it. For instance, host/poi/3.json displays the json file from the poi show page. jhost/pois?id=13.json does not work however.

I prefer not to use a session variable in place of parameters if possible.

Thanks.

Upvotes: 0

Views: 55

Answers (1)

lassej
lassej

Reputation: 6494

It must be

jhost/pois.json?id=13

Upvotes: 1

Related Questions