activerecord-update_counters_with_values 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96bed34674b23690a58379c3f9ce40391434b6c121bb45c6cc7665efac71c506
|
4
|
+
data.tar.gz: 11213973b8ac619cda4c684bb1afd32db6661ab3f1c45392dd773c0bb473e56f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4814b1f029c5c395347f22724d1ea36a9cbd6e9ee874634d5400c14d6b78b28a50d9f03b78204b5e4b447d18f46f38b83500614ac47dc35caa797eede53bcd96
|
7
|
+
data.tar.gz: 42e388b98223f5faec75fc3d7f88cb913552353fb274baa4bc70df5e55023538be1b67ff9febcb4769642d413bc77830c338c16dc0c98d113e55014b0f7b7948
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# ActiveRecord::UpdateCountersWithValues
|
2
2
|
|
3
3
|
Update ActiveRecord counter and update instance value
|
4
4
|
|
@@ -20,6 +20,14 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
```ruby
|
24
|
+
class MyModel < ActiveRecord::Base
|
25
|
+
include Activerecord::UpdateCountersWithValues
|
26
|
+
|
27
|
+
#...
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
23
31
|
### Class methods
|
24
32
|
|
25
33
|
```ruby
|
@@ -48,10 +56,6 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
48
56
|
|
49
57
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
50
58
|
|
51
|
-
## Contributing
|
52
|
-
|
53
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/igor-alexandrov/activerecord-increment-and-return.
|
54
|
-
|
55
59
|
## License
|
56
60
|
|
57
61
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -5,7 +5,7 @@ module ActiveRecord
|
|
5
5
|
module ClassMethods
|
6
6
|
def update_counters_and_return_values(id, counters)
|
7
7
|
query = ActiveRecord::UpdateCountersWithValues::QueryBuilder.new(self).call(id, counters)
|
8
|
-
connection.execute(query, "#{
|
8
|
+
connection.execute(query, "#{name.to_s} Update Counters: #{counters}").to_a
|
9
9
|
end
|
10
10
|
|
11
11
|
def increment_counter_and_return_value(id, counter)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-update_counters_with_values
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Alexandrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|