Skip to content

Commit

Permalink
Left join for /api/posts
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed Mar 2, 2017
1 parent 3d1395b commit a736671
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def filter_generator

def posts
filter = "\x00\x00\x00\x00\x00\x00\x00\x03\xC3\xBF\xC3\xBF\xC2\x80\x00\x00\x00\x00\x01"
@posts = Post.where(:id => params[:ids].split(";")).select(select_fields(filter)).order(:id => :desc).joins(:feedbacks).joins(:deletion_logs).includes(:flag_logs => [:user])
@posts = Post.where(:id => params[:ids].split(";")).select(select_fields(filter)).order(:id => :desc).left_joins(:feedbacks).left_joins(:deletion_logs).includes(:flag_logs => [:user])
@results = @posts.paginate(:page => params[:page], :per_page => @pagesize)
@more = has_more?(params[:page], @results.count)
@results = @results.group(:id)
Expand Down

0 comments on commit a736671

Please sign in to comment.