You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rails: Order by Priority and Date with Limit for Category
# group.rb# When we pass NULL to LIMIT, Postgres treats it as LIMIT ALL (no limit).# https://www.postgresql.org/docs/current/static/sql-select.html#SQL-LIMITdeftopics_prioritized(normal_topics_limit: nil)ids=topic_ids(normal_topics_limit)topics.where(id: ids).prioritizedendprivatedeftopic_ids(normal_topics_limit)special_topics_ids=special_topics.pluck(:id)normal_topics_ids=normal_topics.limit(normal_topics_limit).pluck(:id)special_topics_ids + normal_topics_idsenddefspecial_topicsTopic.where(group: self).where.not(type: "Topic").prioritizedend