So I am working on this project but I am having trouble with a find statement. My code is mostly working but it falls apart when more entries are added.
I am working on a submission manager. I want a table of submissions for editors of a specific genre for which they haven't commented. When they comment I want it removed from table so that only the submissions they need to work on are showing. I tried two methods that produce the same results. One I used a find statement and another I tried a named scope. Right now I can filter out the submissions of the specific genre and then remove ones that have been commented on but soon as a second editor comments on them they show up again.
Here is my code for the named scope
(In the submission model)
named_scope :not_commented_by, lambda { |u| { :include => :comments, :conditions => ['comments.editor_id != ? OR comments.id IS NULL', u.id] } }
(In the User Controller)
@prose = Genre.find_by_name('Prose').submissions.not_commented_by (@user)
Here is my code for the find statement
(In the user controller)
@prose = Genre.find_by_name('Prose').submissions.find(:all, :include => :comments, :conditions => ['comments.editor_id != ? OR comments.id IS NULL', @user.id])
Can anyone explain why this would stop working when a second comment is made? Anyone have suggestions for implementing this better?
Thank you for your time, Christian