I noticed the following syntax error in mars-photo-api/app/controllers/api/v1/latest_photos_controller.rb
class Api::V1::LatestPhotosController < ApplicationController
def index
def index
@rover = Rover.find_by name: params[:rover_id].titleize
if @rover
render json: search_photos, each_serializer: PhotoSerializer, root: :latest_photos
else
render json: { errors: "Invalid Rover Name" }, status: :bad_request
end
end
end
...
end
Notice how the index method is defined twice and nested inside of itself. I am really surprised this doesn't actually throw any errors. I already fixed this in the branch I am working on, which I will make a pull request for soon.
Let me know if there is something I'm not understanding here and this is actually how we want to keep it.
You’re correct, this is a non breaking issue, although oddly enough it will work as expected because of the way Ruby works. A pull request to fix it would be appreciated.
I noticed the following syntax error in
mars-photo-api/app/controllers/api/v1/latest_photos_controller.rb
Notice how the
index
method is defined twice and nested inside of itself. I am really surprised this doesn't actually throw any errors. I already fixed this in the branch I am working on, which I will make a pull request for soon.Let me know if there is something I'm not understanding here and this is actually how we want to keep it.