acts_as_footprintable 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/acts_as_footprintable.gemspec +1 -0
- data/lib/acts_as_footprintable/footprinter.rb +1 -8
- data/lib/acts_as_footprintable/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d90af2f93fa15288f683b8376f4c4761918d5e
|
4
|
+
data.tar.gz: 5aab8f4d0f88e7e94031ff766b675d809a5db676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e4017dc629bd48cce469b8ed3d1d104e2300e76a53f9e64e4b1a74bde6cf1c4c2e99756ae52c5dfe6a692b4cb08c1f93d0635ff9a2b9ede5250deb731193720
|
7
|
+
data.tar.gz: '08b29b1c8e2b4424016c544eb27e41878f3b773f36316d9fefb7756cd6027f0ea5c3d8c7c750c805001f0e7aa52aeb3e2bdda6bce8db4f58c41ba1e78394e0db'
|
data/README.md
CHANGED
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'pg'
|
25
25
|
spec.add_development_dependency 'timecop'
|
26
26
|
spec.add_development_dependency 'database_cleaner', "~> 1.0.1"
|
27
|
+
spec.add_development_dependency 'pry'
|
27
28
|
#spec.add_development_dependency 'combustion', '~> 0.5.1'
|
28
29
|
end
|
@@ -40,14 +40,7 @@ module ActsAsFootprintable
|
|
40
40
|
def recent_footprint_ids(target, limit=nil)
|
41
41
|
recent_footprints = target.group("#{table_name}.footprintable_id, #{table_name}.footprintable_type").
|
42
42
|
select("#{table_name}.footprintable_id, #{table_name}.footprintable_type, MAX(#{table_name}.created_at) AS created_at")
|
43
|
-
|
44
|
-
return [] if recent_footprints_conditions.first.nil?
|
45
|
-
|
46
|
-
columns = recent_footprints_conditions.first.keys.map{|column| "#{table_name}.#{column}" }.join(',')
|
47
|
-
values = recent_footprints_conditions.map { |row|
|
48
|
-
"(#{row.values.map{|value| ActiveRecord::Base::sanitize(value)}.join(',')})"
|
49
|
-
}.join(',')
|
50
|
-
records = footprints.where("(#{columns}) IN (#{values})")
|
43
|
+
records = footprints.where("(#{table_name}.footprintable_id, #{table_name}.footprintable_type, #{table_name}.created_at) IN (#{recent_footprints.to_sql})")
|
51
44
|
records = records.order("footprints.created_at desc")
|
52
45
|
records = records.limit(limit) unless limit.nil?
|
53
46
|
records.pluck(:id)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_footprintable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toyoaki Oko
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.0.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Rails gem to allowing records to leave footprints
|
98
112
|
email: chariderpato@gmail.com
|
99
113
|
executables: []
|