I’m working on a Rails project at the moment, and I’m building a view using json_builder to use with the Layar API like so:
layer "Layer name"
errorString "ok"
errorCode 0
hotspots @inspections do |inspection|
id inspection.slug
anchor do
geolocation do
lat inspection.lat
lon inspection.lng
end
end
text do
title inspection.name
description "#{inspection.rating} out of 5"
imageURL "http://my-url.com/assets/rating#{inspection.rating}.png"
end
end
However, when I load this view in my browser, the title part of my JSON doesn’t appear. I’ve managed to narrow this down to a helper method in my layout_helper file (I’ve been using nifty-generators), also named title. As I don’t need this helper, is there any way of running clear_helpers for this particular controller action only? Or is there a neater way of doing this? (I’m pretty new to Rails, as you can probably tell!)
I ended up renaming the problematic helper method to
pagetitleand changing my views. Sometimes the simplest solutions are easiest!