[#42] add aliase to table in the sql request

This commit is contained in:
Alexander Machehin 2013-06-06 13:02:25 +06:00
parent f75e2fdb58
commit 7d1f295e18
1 changed files with 3 additions and 3 deletions

View File

@ -64,9 +64,9 @@ class Api::V1::IssuesController < Api::V1::BaseController
when 'none' when 'none'
@issues = @issues.where(:assigned_id => nil) @issues = @issues.where(:assigned_id => nil)
when '*' when '*'
@issues = @issues.where('assigned_id IS NOT NULL') @issues = @issues.where('issues.assigned_id IS NOT NULL')
else else
@issues = @issues.where('assignees_issues.uname = ?', params[:assignee]) @issues = @issues.where('issues.assignees_issues.uname = ?', params[:assignee])
end end
end end
@ -91,7 +91,7 @@ class Api::V1::IssuesController < Api::V1::BaseController
direction = params[:direction] == 'asc' ? 'ASC' : 'DESC' direction = params[:direction] == 'asc' ? 'ASC' : 'DESC'
@issues = @issues.order("#{sort} #{direction}") @issues = @issues.order("#{sort} #{direction}")
@issues = @issues.where('created_at >= to_timestamp(?)', params[:since]) if params[:since] =~ /\A\d+\z/ @issues = @issues.where('issues.created_at >= to_timestamp(?)', params[:since]) if params[:since] =~ /\A\d+\z/
@issues.paginate(paginate_params) @issues.paginate(paginate_params)
render :index render :index
end end