| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Wed, 24 Dec 2025 05:23:11 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20100221070706
location: https://web.archive.org/web/20100221070706/https://github.com/thoughtbot/squirrel
server-timing: captures_list;dur=1.042612, exclusion.robots;dur=0.186530, exclusion.robots.policy;dur=0.165755, esindex;dur=0.016080, cdx.remote;dur=11.024343, LoadShardBlock;dur=143.716470, PetaboxLoader3.datanode;dur=54.888215, PetaboxLoader3.resolve;dur=24.834816
x-app-server: wwwb-app28-dc8
x-ts: 302
x-tr: 229
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app28; path=/
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Wed, 24 Dec 2025 05:23:13 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.61
x-archive-orig-date: Sun, 21 Feb 2010 07:07:06 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "c4634be8c7cbee94063c982d17fb1e48"
x-archive-orig-x-runtime: 154ms
x-archive-orig-content-length: 24058
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sun, 21 Feb 2010 07:07:06 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_14_20100221034838_crawl101-c/51_14_20100221070553_crawl101.arc.gz
server-timing: captures_list;dur=0.896186, exclusion.robots;dur=0.041921, exclusion.robots.policy;dur=0.024835, esindex;dur=0.016106, cdx.remote;dur=14.352205, LoadShardBlock;dur=1135.801565, PetaboxLoader3.datanode;dur=80.916464, PetaboxLoader3.resolve;dur=1157.660341, load_resource;dur=118.849775
x-app-server: wwwb-app28-dc8
x-ts: 200
x-tr: 1347
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
thoughtbot's squirrel at master - GitHub
This service is courtesy of Pledgie.
thoughtbot / squirrel
- Source
- Commits
- Network (21)
- Issues (3)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
Branches (1)
- master ✓
- Tags (0)
Sending Request…
Enable Donations
Pledgie Donations
Once activated, we'll place the following badge in your repository's detail box:
Natural-looking Finder Queries for ActiveRecord — Read more
squirrel /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Fri Jun 20 13:55:12 -0700 2008 | Added .gitignore [Jon Yurek] |
| |
README | Thu Apr 24 14:48:03 -0700 2008 | added website to readme git-svn-id: https://s... [jyurek] |
| |
Rakefile | Mon Mar 24 18:44:42 -0700 2008 | Added first pass at a will_paginate compatabili... [jyurek] |
| |
init.rb | Fri Jun 20 13:54:27 -0700 2008 | Added capacity for scoped to take a Squirrel bl... [Jon Yurek] |
| |
lib/ | Thu Jun 26 13:24:49 -0700 2008 | Fixed the actual problem this time. [Jon Yurek] |
| |
test/ | Wed Mar 04 06:41:03 -0800 2009 | Updating test_helper so it actually runs tests [qrush] |
README
Squirrel ====== SQL Simplification Plugin for ActiveRecord This plugin extends the ActiveRecord::Base#find method to be able to take a block of Ruby which will get parsed into a nice SQL string and have its results returned. Author:: Jon Yurek (mailto:jyurek@thoughtbot.com) Copyright:: Copyright(c) 2008 thoughtbot, inc. License:: Distributes under the same terms as Ruby Website:: https://www.thoughtbot.com/projects/squirrel Squirrel is a plugin for ActiveRecord which attempts to make SQL querier a much more natural prospect. You can write your queries in Ruby code and they get translated, including all proper table joins, into relevant SQL code and executed, returning your results. User.find(:all) do first_name.contains? params[:first_name] posts.created_at >= 1.week.ago end This query will return all Users that have a first_name that contains whatever was passed in as the "first_name" parameter, and that has any Posts that were created"in the past week. Both columns and associations are referenced as methods. Columns are referenced exactly as they are in the database, and associations are referenced exactly as they are specified in their respective has_many, belongs_to, etc calls. For example, in the snippet above, the User has_many :posts, and so we use "posts" as the method to refer to that association. This mechanism works for *all* of ActiveRecord's associations, because it piggybacks on AR's eager loading functionality, which always produces the joins necessary for getting the columns required. By default, all conditions specified in the query are ANDed together. If it is necessary to have any condition match, you can group your conditions together using the "any" method, which takes a block containing the conditions. For example: Playlist.find(:all) do any do name == "Party Mix" total_length > 3600 end end ... will find all Playlists that either have a name of "Party Mix" or that have a total length of 1 hour (3600 seconds). There is also an "all" method that works similarly, but joins with "AND". These groups are nestable." Currenly, there is no allowance in Squirrel for either grouping or fetching columns that aren't part of any of the included tables.
