Skip to content

Instantly share code, notes, and snippets.

@kingcu
Created February 22, 2011 02:46
Show Gist options
  • Save kingcu/838126 to your computer and use it in GitHub Desktop.
Save kingcu/838126 to your computer and use it in GitHub Desktop.
if route.save
#add already saved photos to the route
if params[:new_planner]
to_parse = []
if route_data['course_points'] and route_data['course_points'].length > 2
to_parse << JSON.parse(route_data['course_points'])
end
if route_data['points_of_interest'] and route_data['points_of_interest'].length > 2
to_parse << JSON.parse(route_data['points_of_interest'])
end
to_parse.each do |blah|
blah.each do |pt|
if pt['photo_ids']
pt['photo_ids'].each do |id|
photo = @current_user.photos.where(:id => id)
route.photos << photo if photo
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment