Skip to content

Instantly share code, notes, and snippets.

@mkucko
mkucko / index.html.erb
Created April 29, 2025 12:50 — forked from eliotsykes/index.html.erb
Testing Rails: defining temporary controller, view and route in feature spec
<% # This file lives at spec/features/views/index.html.erb %>
<h1>My Temporary Page</h1>
@mkucko
mkucko / arel_cheatsheet_on_steroids.md
Created April 17, 2025 09:46 — forked from ProGM/arel_cheatsheet_on_steroids.md
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@mkucko
mkucko / arel_helpers.rb
Created April 17, 2025 09:45 — forked from hadees/arel_helpers.rb
Arel Helpers
module ArelHelpers
extend self
def self.included(base)
base.extend self
end
def asterisk(arel_table_or_model)
arel_table, columns = case arel_table_or_model
when Arel::Table