From 7317d6b26503dc6763a02fe947c778ec6f1b7e1b Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 6 Jun 2016 14:39:40 +0200 Subject: [PATCH] Rename current_build sort to current_build_id This a quick workaround for sorting by current_build. When the field that we use to sort is the same as one of the associations name API V3 will try to join the association. So in this case it will try to join :current_build, which fails. This needs a better solution, but I want to get this working for now. --- lib/travis/api/v3/queries/repositories.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/travis/api/v3/queries/repositories.rb b/lib/travis/api/v3/queries/repositories.rb index 1f45299c..7e8f74d7 100644 --- a/lib/travis/api/v3/queries/repositories.rb +++ b/lib/travis/api/v3/queries/repositories.rb @@ -4,7 +4,7 @@ module Travis::API::V3 sortable_by :id, :github_id, :owner_name, :name, active: sort_condition(:active), :'default_branch.last_build' => 'builds.started_at' sortable_by :id, :github_id, :owner_name, :name, active: sort_condition(:active), :'default_branch.last_build' => 'builds.started_at', - :current_build => "repositories.current_build_id %{order} NULLS LAST" + :current_build_id => "repositories.current_build_id %{order} NULLS LAST" def for_member(user, **options) all(user: user, **options).joins(:users).where(users: user_condition(user), invalidated_at: nil)