pacecar 1.5.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +9 -1
- data/Appraisals +9 -17
- data/Gemfile +1 -1
- data/Gemfile.lock +93 -108
- data/MIT-LICENSE +1 -1
- data/README.md +10 -109
- data/Rakefile +9 -5
- data/TESTING.md +40 -0
- data/gemfiles/rails_4_mysql2_driver.gemfile +8 -0
- data/gemfiles/rails_4_pg_driver.gemfile +8 -0
- data/gemfiles/rails_4_sqlite3_driver.gemfile +8 -0
- data/lib/pacecar.rb +0 -10
- data/lib/pacecar/boolean.rb +8 -20
- data/lib/pacecar/helpers.rb +7 -16
- data/lib/pacecar/limit.rb +9 -9
- data/lib/pacecar/order.rb +9 -9
- data/lib/pacecar/polymorph.rb +5 -5
- data/lib/pacecar/presence.rb +8 -9
- data/lib/pacecar/search.rb +8 -32
- data/lib/pacecar/state.rb +13 -9
- data/lib/pacecar/version.rb +1 -1
- data/pacecar.gemspec +18 -16
- data/spec/boolean_spec.rb +6 -18
- data/spec/dummy/app/models/mammal.rb +1 -1
- data/spec/dummy/app/models/post.rb +2 -2
- data/spec/dummy/app/models/user.rb +1 -6
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +4 -26
- data/spec/dummy/config/boot.rb +3 -9
- data/spec/dummy/config/database.yml +1 -7
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/development.rb +15 -12
- data/spec/dummy/config/environments/production.rb +57 -26
- data/spec/dummy/config/environments/test.rb +16 -15
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +9 -3
- data/spec/dummy/config/initializers/secret_token.rb +7 -2
- data/spec/dummy/config/initializers/session_store.rb +1 -6
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/config/routes.rb +22 -24
- data/spec/factories.rb +2 -2
- data/spec/helpers_spec.rb +18 -26
- data/spec/integration/navigation_spec.rb +4 -5
- data/spec/limit_spec.rb +11 -11
- data/spec/order_spec.rb +8 -8
- data/spec/pacecar_spec.rb +3 -3
- data/spec/polymorph_spec.rb +6 -6
- data/spec/presence_spec.rb +9 -9
- data/spec/search_spec.rb +14 -48
- data/spec/spec_helper.rb +11 -17
- data/spec/state_spec.rb +29 -29
- metadata +76 -70
- data/gemfiles/rails-3.0.11-database-mysql.gemfile +0 -8
- data/gemfiles/rails-3.0.11-database-mysql.gemfile.lock +0 -134
- data/gemfiles/rails-3.0.11-database-mysql2.gemfile +0 -8
- data/gemfiles/rails-3.0.11-database-mysql2.gemfile.lock +0 -134
- data/gemfiles/rails-3.0.11-database-pg.gemfile +0 -8
- data/gemfiles/rails-3.0.11-database-pg.gemfile.lock +0 -134
- data/gemfiles/rails-3.0.11-database-sqlite3-ruby.gemfile +0 -8
- data/gemfiles/rails-3.0.11-database-sqlite3-ruby.gemfile.lock +0 -136
- data/gemfiles/rails-3.0.11-database-sqlite3.gemfile +0 -8
- data/gemfiles/rails-3.0.11-database-sqlite3.gemfile.lock +0 -134
- data/gemfiles/rails-3.1.3-database-mysql.gemfile +0 -8
- data/gemfiles/rails-3.1.3-database-mysql.gemfile.lock +0 -144
- data/gemfiles/rails-3.1.3-database-mysql2.gemfile +0 -8
- data/gemfiles/rails-3.1.3-database-mysql2.gemfile.lock +0 -144
- data/gemfiles/rails-3.1.3-database-pg.gemfile +0 -8
- data/gemfiles/rails-3.1.3-database-pg.gemfile.lock +0 -144
- data/gemfiles/rails-3.1.3-database-sqlite3-ruby.gemfile +0 -8
- data/gemfiles/rails-3.1.3-database-sqlite3-ruby.gemfile.lock +0 -146
- data/gemfiles/rails-3.1.3-database-sqlite3.gemfile +0 -8
- data/gemfiles/rails-3.1.3-database-sqlite3.gemfile.lock +0 -144
- data/lib/pacecar/associations.rb +0 -39
- data/lib/pacecar/datetime.rb +0 -91
- data/lib/pacecar/duration.rb +0 -51
- data/lib/pacecar/numeric.rb +0 -29
- data/lib/pacecar/ranking.rb +0 -53
- data/spec/associations_spec.rb +0 -32
- data/spec/datetime_spec.rb +0 -92
- data/spec/duration_spec.rb +0 -22
- data/spec/numeric_spec.rb +0 -43
- data/spec/ranking_spec.rb +0 -63
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3836ece83a09695d40726ba5edc03a732bb5ad32
|
4
|
+
data.tar.gz: 379c0b0fdd589eeadac134bde37fa0ce62c4c982
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d92596981106b395d88a6a8ef63bc4970928abe6c30e6a9b8c07aa8ddd851fce6945ea01f20b4fed213d0776fff80574772d142c945b137e0390d51d476569ea
|
7
|
+
data.tar.gz: c561da6d4b13758e9174e3de866ef97731cc8ccf8141900a1fc48422f0e19c75f800a6e3bdf625467fef0d74b686c94e2d4bc01319ce8b503693e63641cb8ac2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.9.3
|
4
|
+
- 2.0.0
|
5
|
+
gemfile:
|
6
|
+
- gemfiles/rails_4_mysql2_driver.gemfile
|
7
|
+
- gemfiles/rails_4_pg_driver.gemfile
|
8
|
+
- gemfiles/rails_4_sqlite3_driver.gemfile
|
2
9
|
before_script:
|
3
10
|
- "mysql -e 'create database pacecar_test;' >/dev/null"
|
4
11
|
- "psql -c 'create database pacecar_test;' -U postgres >/dev/null"
|
12
|
+
- "cd spec/dummy && RAILS_ENV=test bundle exec rake db:migrate && cd -"
|
data/Appraisals
CHANGED
@@ -1,22 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
rails_versions.each do |rails_version|
|
5
|
-
database_drivers.each do |database_driver|
|
6
|
-
appraise "rails-#{rails_version}-database-#{database_driver}" do
|
7
|
-
gem "rails", rails_version
|
8
|
-
gem database_driver
|
9
|
-
end
|
10
|
-
end
|
1
|
+
appraise 'rails_4_mysql2_driver' do
|
2
|
+
gem 'rails', '4.0.0'
|
3
|
+
gem 'mysql2'
|
11
4
|
end
|
12
5
|
|
13
|
-
|
14
|
-
|
15
|
-
gem
|
16
|
-
gem "mysql2", "0.3.7"
|
6
|
+
appraise 'rails_4_pg_driver' do
|
7
|
+
gem 'rails', '4.0.0'
|
8
|
+
gem 'pg'
|
17
9
|
end
|
18
10
|
|
19
|
-
appraise
|
20
|
-
gem
|
21
|
-
gem
|
11
|
+
appraise 'rails_4_sqlite3_driver' do
|
12
|
+
gem 'rails', '4.0.0'
|
13
|
+
gem 'sqlite3'
|
22
14
|
end
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,129 +1,114 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pacecar (
|
4
|
+
pacecar (2.0.0)
|
5
|
+
activerecord (>= 4.0.0)
|
5
6
|
|
6
7
|
GEM
|
7
|
-
remote:
|
8
|
+
remote: https://rubygems.org/
|
8
9
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
activesupport (=
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
activesupport (= 3.0.3)
|
35
|
-
activesupport (3.0.3)
|
36
|
-
appraisal (0.4.0)
|
10
|
+
actionmailer (4.0.0)
|
11
|
+
actionpack (= 4.0.0)
|
12
|
+
mail (~> 2.5.3)
|
13
|
+
actionpack (4.0.0)
|
14
|
+
activesupport (= 4.0.0)
|
15
|
+
builder (~> 3.1.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
rack (~> 1.5.2)
|
18
|
+
rack-test (~> 0.6.2)
|
19
|
+
activemodel (4.0.0)
|
20
|
+
activesupport (= 4.0.0)
|
21
|
+
builder (~> 3.1.0)
|
22
|
+
activerecord (4.0.0)
|
23
|
+
activemodel (= 4.0.0)
|
24
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
25
|
+
activesupport (= 4.0.0)
|
26
|
+
arel (~> 4.0.0)
|
27
|
+
activerecord-deprecated_finders (1.0.3)
|
28
|
+
activesupport (4.0.0)
|
29
|
+
i18n (~> 0.6, >= 0.6.4)
|
30
|
+
minitest (~> 4.2)
|
31
|
+
multi_json (~> 1.3)
|
32
|
+
thread_safe (~> 0.1)
|
33
|
+
tzinfo (~> 0.3.37)
|
34
|
+
appraisal (0.5.2)
|
37
35
|
bundler
|
38
36
|
rake
|
39
|
-
arel (
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
ffi (~> 0.6.3)
|
53
|
-
culerity (0.2.14)
|
54
|
-
diff-lcs (1.1.2)
|
55
|
-
erubis (2.6.6)
|
56
|
-
abstract (>= 1.0.0)
|
57
|
-
factory_girl (1.3.2)
|
58
|
-
factory_girl_rails (1.0)
|
59
|
-
factory_girl (~> 1.3)
|
60
|
-
rails (>= 3.0.0.beta4)
|
61
|
-
ffi (0.6.3)
|
62
|
-
rake (>= 0.8.7)
|
63
|
-
i18n (0.5.0)
|
64
|
-
json_pure (1.4.6)
|
65
|
-
mail (2.2.12)
|
66
|
-
activesupport (>= 2.3.6)
|
67
|
-
i18n (>= 0.4.0)
|
37
|
+
arel (4.0.0)
|
38
|
+
atomic (1.1.12)
|
39
|
+
builder (3.1.4)
|
40
|
+
diff-lcs (1.2.4)
|
41
|
+
erubis (2.7.0)
|
42
|
+
factory_girl (4.2.0)
|
43
|
+
activesupport (>= 3.0.0)
|
44
|
+
factory_girl_rails (4.2.1)
|
45
|
+
factory_girl (~> 4.2.0)
|
46
|
+
railties (>= 3.0.0)
|
47
|
+
hike (1.2.3)
|
48
|
+
i18n (0.6.4)
|
49
|
+
mail (2.5.4)
|
68
50
|
mime-types (~> 1.16)
|
69
51
|
treetop (~> 1.4.8)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
rack-test (0.
|
52
|
+
metaclass (0.0.1)
|
53
|
+
mime-types (1.23)
|
54
|
+
minitest (4.7.5)
|
55
|
+
mocha (0.14.0)
|
56
|
+
metaclass (~> 0.0.1)
|
57
|
+
multi_json (1.7.7)
|
58
|
+
polyglot (0.3.3)
|
59
|
+
rack (1.5.2)
|
60
|
+
rack-test (0.6.2)
|
79
61
|
rack (>= 1.0)
|
80
|
-
rails (
|
81
|
-
actionmailer (=
|
82
|
-
actionpack (=
|
83
|
-
activerecord (=
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
railties (
|
89
|
-
actionpack (=
|
90
|
-
activesupport (=
|
62
|
+
rails (4.0.0)
|
63
|
+
actionmailer (= 4.0.0)
|
64
|
+
actionpack (= 4.0.0)
|
65
|
+
activerecord (= 4.0.0)
|
66
|
+
activesupport (= 4.0.0)
|
67
|
+
bundler (>= 1.3.0, < 2.0)
|
68
|
+
railties (= 4.0.0)
|
69
|
+
sprockets-rails (~> 2.0.0)
|
70
|
+
railties (4.0.0)
|
71
|
+
actionpack (= 4.0.0)
|
72
|
+
activesupport (= 4.0.0)
|
91
73
|
rake (>= 0.8.7)
|
92
|
-
thor (
|
93
|
-
rake (
|
94
|
-
rspec (2.4
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
rspec-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
74
|
+
thor (>= 0.18.1, < 2.0)
|
75
|
+
rake (10.1.0)
|
76
|
+
rspec-core (2.14.4)
|
77
|
+
rspec-expectations (2.14.0)
|
78
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
79
|
+
rspec-mocks (2.14.2)
|
80
|
+
rspec-rails (2.14.0)
|
81
|
+
actionpack (>= 3.0)
|
82
|
+
activesupport (>= 3.0)
|
83
|
+
railties (>= 3.0)
|
84
|
+
rspec-core (~> 2.14.0)
|
85
|
+
rspec-expectations (~> 2.14.0)
|
86
|
+
rspec-mocks (~> 2.14.0)
|
87
|
+
sprockets (2.10.0)
|
88
|
+
hike (~> 1.2)
|
89
|
+
multi_json (~> 1.0)
|
90
|
+
rack (~> 1.0)
|
91
|
+
tilt (~> 1.1, != 1.3.0)
|
92
|
+
sprockets-rails (2.0.0)
|
93
|
+
actionpack (>= 3.0)
|
94
|
+
activesupport (>= 3.0)
|
95
|
+
sprockets (~> 2.8)
|
96
|
+
thor (0.18.1)
|
97
|
+
thread_safe (0.1.2)
|
98
|
+
atomic
|
99
|
+
tilt (1.4.1)
|
100
|
+
treetop (1.4.14)
|
101
|
+
polyglot
|
115
102
|
polyglot (>= 0.3.1)
|
116
|
-
tzinfo (0.3.
|
117
|
-
xpath (0.1.3)
|
118
|
-
nokogiri (~> 1.3)
|
103
|
+
tzinfo (0.3.37)
|
119
104
|
|
120
105
|
PLATFORMS
|
121
106
|
ruby
|
122
107
|
|
123
108
|
DEPENDENCIES
|
124
|
-
appraisal
|
125
|
-
capybara (>= 0.4.0)
|
109
|
+
appraisal
|
126
110
|
factory_girl_rails
|
127
111
|
mocha
|
128
112
|
pacecar!
|
129
|
-
|
113
|
+
rails
|
114
|
+
rspec-rails
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Pacecar
|
2
2
|
=======
|
3
3
|
|
4
|
+
[](http://travis-ci.org/thoughtbot/pacecar)
|
5
|
+
|
4
6
|
Pacecar adds scope methods and other common functionality to ActiveRecord classes via database column introspection.
|
5
7
|
|
6
8
|
Pacecar automatically includes the Pacecar::Helpers module into all ActiveRecord::Base classes.
|
@@ -17,19 +19,15 @@ To get some subset (for example, only the state functionality), you can do somet
|
|
17
19
|
include Pacecar::State
|
18
20
|
end
|
19
21
|
|
20
|
-
Pacecar supports mysql, postgres and sqlite database drivers, and is compatible with Rails
|
22
|
+
Pacecar supports mysql, postgres and sqlite database drivers, and is compatible with Rails 4.x versions.
|
21
23
|
|
22
24
|
Installation
|
23
25
|
------------
|
24
26
|
|
25
|
-
|
27
|
+
Just include in your Gemfile:
|
26
28
|
|
27
29
|
gem 'pacecar'
|
28
30
|
|
29
|
-
For prior rails versions, there is a rails2 branch to use:
|
30
|
-
|
31
|
-
gem 'pacecar', :git => 'git://github.com/thoughtbot/pacecar.git', :branch => 'rails2'
|
32
|
-
|
33
31
|
Usage
|
34
32
|
-----
|
35
33
|
|
@@ -66,22 +64,18 @@ And some basic model declarations:
|
|
66
64
|
|
67
65
|
class User < ActiveRecord::Base
|
68
66
|
include Pacecar
|
69
|
-
has_many :posts, :
|
67
|
+
has_many :posts, as: :owner
|
70
68
|
has_many :comments
|
71
69
|
has_many :articles
|
72
|
-
has_ranking :comments
|
73
|
-
has_recent_records :comments
|
74
|
-
has_recent_records :articles, :comments
|
75
|
-
has_calculated_records :comments, :on => :rating
|
76
70
|
end
|
77
71
|
|
78
72
|
class Post < ActiveRecord::Base
|
79
73
|
include Pacecar
|
80
74
|
PUBLICATION_STATES = %w(Draft Submitted Rejected Accepted)
|
81
75
|
TYPES = %w(Free Open Private Anonymous PostModern)
|
82
|
-
belongs_to :owner, :
|
76
|
+
belongs_to :owner, polymorphic: true
|
83
77
|
has_state :publication_state
|
84
|
-
has_state :post_type, :
|
78
|
+
has_state :post_type, with: TYPES
|
85
79
|
has_polymorph :owner
|
86
80
|
end
|
87
81
|
|
@@ -113,31 +107,10 @@ Records ordered by first\_name (default to 'asc', can specify to override):
|
|
113
107
|
User.by_first_name(:asc)
|
114
108
|
User.by_first_name(:desc)
|
115
109
|
|
116
|
-
Records where an attribute matches a search term (column LIKE "%term%"):
|
117
|
-
|
118
|
-
User.first_name_matches('John')
|
119
|
-
|
120
|
-
Records where an attribute starts or ends with a search term:
|
121
|
-
|
122
|
-
User.first_name_starts_with('A')
|
123
|
-
User.first_name_ends_with('a')
|
124
|
-
|
125
110
|
Records where an attribute matches exactly a term:
|
126
111
|
|
127
112
|
User.first_name_equals('John')
|
128
113
|
|
129
|
-
Records where any non-state text or string column matches term:
|
130
|
-
|
131
|
-
User.search_for('test')
|
132
|
-
|
133
|
-
Records where any of a list of columns match the term:
|
134
|
-
|
135
|
-
User.search_for 'test', :on => [:first_name, :last_name]
|
136
|
-
|
137
|
-
Records where all of a list of columns match the term:
|
138
|
-
|
139
|
-
User.search_for 'test', :on => [:first_name, :last_name], :require => :all
|
140
|
-
|
141
114
|
Boolean columns
|
142
115
|
---------------
|
143
116
|
|
@@ -146,40 +119,6 @@ Records that are all admins or non-admins:
|
|
146
119
|
User.admin
|
147
120
|
User.not_admin
|
148
121
|
|
149
|
-
The "balance" (count of true minus false for column in question):
|
150
|
-
|
151
|
-
User.admin_balance
|
152
|
-
|
153
|
-
Datetime columns
|
154
|
-
----------------
|
155
|
-
|
156
|
-
Records approved before or after certain times:
|
157
|
-
|
158
|
-
User.approved_at_before(5.days.ago)
|
159
|
-
User.approved_at_after(4.weeks.ago)
|
160
|
-
|
161
|
-
Records with approved\_at in the past or future:
|
162
|
-
|
163
|
-
User.approved_at_in_past
|
164
|
-
User.approved_at_in_future
|
165
|
-
|
166
|
-
Records with approved\_at inside or outside of two times:
|
167
|
-
|
168
|
-
User.approved_at_inside(10.days.ago, 1.day.ago)
|
169
|
-
User.approved_at_outside(2.days.ago, 1.day.ago)
|
170
|
-
|
171
|
-
Records with certain year, month or day:
|
172
|
-
|
173
|
-
User.approved_at_in_year(2000)
|
174
|
-
User.approved_at_in_month(01)
|
175
|
-
User.approved_at_in_day(01)
|
176
|
-
|
177
|
-
Records with a duration (time delta between two columns) of, over or under a certain number of days:
|
178
|
-
|
179
|
-
User.with_duration_of(14, :approved_at, :rejected_at)
|
180
|
-
User.with_duration_over(14, :approved_at, :rejected_at)
|
181
|
-
User.with_duration_under(14, :approved_at, :rejected_at)
|
182
|
-
|
183
122
|
Polymorphic relationships
|
184
123
|
-------------------------
|
185
124
|
|
@@ -187,30 +126,6 @@ Records which have an owner\_type of User:
|
|
187
126
|
|
188
127
|
Post.for_owner_type(User)
|
189
128
|
|
190
|
-
Associations
|
191
|
-
------------
|
192
|
-
|
193
|
-
Records with the most and least associated records:
|
194
|
-
|
195
|
-
User.maximum_comments
|
196
|
-
User.minimum_comments
|
197
|
-
|
198
|
-
Records with associated records since a certain time:
|
199
|
-
|
200
|
-
User.recent_comments_since(2.days.ago)
|
201
|
-
User.recent_comments_and_posts_since(3.days.ago)
|
202
|
-
User.recent_comments_or_posts_since(4.days.ago)
|
203
|
-
|
204
|
-
Records with highest and lowest association column average:
|
205
|
-
|
206
|
-
User.by_comments_highest_rating_average
|
207
|
-
User.by_comments_lowest_rating_average
|
208
|
-
|
209
|
-
Records with highest and lowest association column total:
|
210
|
-
|
211
|
-
User.by_comments_highest_rating_total
|
212
|
-
User.by_comments_lowest_rating_total
|
213
|
-
|
214
129
|
State columns
|
215
130
|
-------------
|
216
131
|
|
@@ -224,16 +139,6 @@ Query methods on instances to check state:
|
|
224
139
|
Post.first.publication_state_draft?
|
225
140
|
Post.last.post_type_not_open?
|
226
141
|
|
227
|
-
Numeric columns
|
228
|
-
---------------
|
229
|
-
|
230
|
-
Records which are greater than or less than a certain value:
|
231
|
-
|
232
|
-
User.age_greater_than(21)
|
233
|
-
User.age_greater_than_or_equal_to(21)
|
234
|
-
User.age_less_than(21)
|
235
|
-
User.age_less_than_or_equal_to(21)
|
236
|
-
|
237
142
|
Limits
|
238
143
|
------
|
239
144
|
|
@@ -246,13 +151,9 @@ Named scopes
|
|
246
151
|
|
247
152
|
Because these are all scope, you can combine them.
|
248
153
|
|
249
|
-
To get all users that have a first\_name set, who are admins
|
250
|
-
|
251
|
-
User.first_name_present.admin.approved_at_before(2.weeks.ago).by_first_name
|
252
|
-
|
253
|
-
To get the top 10 commenters:
|
154
|
+
To get all users that have a first\_name set, who are admins:
|
254
155
|
|
255
|
-
User.
|
156
|
+
User.first_name_present.admin
|
256
157
|
|
257
158
|
Supported Databases
|
258
159
|
-------------------
|
@@ -275,4 +176,4 @@ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
|
275
176
|
License
|
276
177
|
-------
|
277
178
|
|
278
|
-
Pacecar is Copyright © 2008-
|
179
|
+
Pacecar is Copyright © 2008-2013 thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|