Is there an easy way to have a piece of code or even an entire layout
that not only loads for a given controller, but only a given action on
that controller? Specifically, I’m trying to load a small Google Map
using their API, and I’ve written it to automatically geocode the
address based on an address value passed from the controller.
I have a controller called “events” that lists a bunch of upcoming
events, and when you select an event, a details page for that event is
invoked via the “details” action. The API only gets passed the address
for geocoding when “details” is loaded, but in its current state, it
also wants the address everywhere in the events controller, and since
it’s “nil” Rails gives me an error. I want to be able to only load the
whole “events” view is loaded. Is there an easy way to do this with
(Sorry for the roundabout question, as I’m something of a newb when it
comes to programming and a total newb when it comes to RoR).