diff --git a/lib/unread/readable_scopes.rb b/lib/unread/readable_scopes.rb index 7c1aa5c..14c57c2 100644 --- a/lib/unread/readable_scopes.rb +++ b/lib/unread/readable_scopes.rb @@ -7,7 +7,7 @@ def join_read_marks(user) joins "LEFT JOIN read_marks ON read_marks.readable_type = '#{base_class.name}' AND read_marks.readable_id = #{quoted_table_name}.#{quoted_primary_key} - AND read_marks.user_id = #{user.id} + AND read_marks.user_id = #{quote_bound_value(user.id)} AND read_marks.timestamp >= #{quoted_table_name}.#{connection.quote_column_name(readable_options[:on])}" end @@ -40,7 +40,7 @@ def read_by(user) def with_read_marks_for(user) join_read_marks(user).select("#{quoted_table_name}.*, read_marks.id AS read_mark_id, - #{user.id} AS read_mark_user_id") + #{quote_bound_value user.id} AS read_mark_user_id") end end end