If you are using a gon gem for your vars in a coffee script, you can use this template:
Place a flag for each action in the controller:
def index @gps_coords = GpsCoord.all
In a correlating coffee script, use these flags to distinguish between both actions:
# index action? if gon.index? first_coord = gon.gps_coords[0] map.setView([first_coord.latitude, first_coord.longitude], 15); # show action? if gon.show? map.setView([gon.lat, gon.lon], 15);
Stephan Schielke Oct 05 '14 at 8:31 on 2014-10-05 20:31
source share