Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Created February 28, 2012 22:49
Show Gist options
  • Save luckyruby/1935816 to your computer and use it in GitHub Desktop.
Save luckyruby/1935816 to your computer and use it in GitHub Desktop.
Started GET "/api/cartypes?location=PHX4" for 127.0.0.1 at 2012-02-28 17:48:25 -0500
Processing by ApiController#cartypes as HTML
Parameters: {"location"=>"PHX4"}
(0.6ms) SELECT car_types.name FROM "car_types" WHERE (locations.code = 'PHX4')
PG::Error: ERROR: missing FROM-clause entry for table "locations"
LINE 1: SELECT car_types.name FROM "car_types" WHERE (locations.cod...
^
: SELECT car_types.name FROM "car_types" WHERE (locations.code = 'PHX4')
Completed 500 Internal Server Error in 14ms
ActiveRecord::StatementInvalid (PG::Error: ERROR: missing FROM-clause entry for table "locations"
LINE 1: SELECT car_types.name FROM "car_types" WHERE (locations.cod...
^
: SELECT car_types.name FROM "car_types" WHERE (locations.code = 'PHX4')):
app/models/car_type.rb:10:in `supported_by'
app/controllers/api_controller.rb:8:in `cartypes'
def self.supported_by(location)
if location
includes(:locations).where("locations.code = ?", location.upcase).pluck("car_types.name")
else
[]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment