Note: Using StandardJS rules.
function * range(start, end, step = 1) {
while (start <= end) {
yield start
Note: Using StandardJS rules.
function * range(start, end, step = 1) {
while (start <= end) {
yield start
# 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 |
# 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 |
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.
# 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)