Created
February 28, 2012 22:49
-
-
Save luckyruby/1935816 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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