# 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-LIMIT
def topics_prioritized(normal_topics_limit: nil)
ids = topic_ids(normal_topics_limit)
We have a _user
partial that we want to render from two different resources, passing a collection.
The only thing that needs to change in the partial is the path inside the link_to
helper.
We can use self.send("path", object)
inside link_to
to achieve this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class ObjectNameDecorator < SimpleDelegator | |
delegate :class, :is_a?, to: :__getobj__ | |
def self.collection(objects) | |
objects.map { |group| ObjectNameDecorator.new(object) } | |
end | |
private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Alerts of SQL queries made within views. | |
# | |
# https://www.driftingruby.com/episodes/improving-partial-loading-performance | |
module StrictQueries | |
class SQLWithViewError < StandardError; end | |
module Concern | |
extend ActiveSupport::Concern |
Note: Using StandardJS rules.
function * range(start, end, step = 1) {
while (start <= end) {
yield start
git reset HEAD^ path/to/file/to/revert
git commit --amend
Source: https://superuser.com/a/229296