Guest User

Untitled

a guest
Feb 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. ActiveRecord::StatementInvalid in ImageboardController#index
  2.  
  3. Mysql::Error: #23000Column 'parent_id' in where clause is ambiguous: SELECT COUNT(DISTINCT comments.id) FROM comments LEFT OUTER JOIN comments childrens_comments ON childrens_comments.parent_id = comments.id WHERE (parent_id IS NULL && board_id = 1)
  4.  
  5. class ImageboardController < ApplicationController
  6. def index
  7. @pages, @parents =
  8. paginate( :comments,
  9. :include => [:children],
  10. :per_page => @board.setting(:threads_per_page),
  11. :conditions => "parent_id IS NULL && board_id = #{@board.id}",
  12. :order => "bumped_on DESC")
  13. end
  14. end
  15.  
  16. require 'cgi'
  17. require 'digest/md5'
  18. require 'RMagick'
  19. include Magick
  20.  
  21. class Comment < ActiveRecord::Base
  22. belongs_to :board
  23. acts_as_tree :order => "created_on ASC", :dependent => :destroy
  24. end
Add Comment
Please, Sign In to add comment