acts_as_footprintable 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Gemfile +1 -2
- data/lib/acts_as_footprintable/footprint.rb +2 -2
- data/lib/acts_as_footprintable/footprinter.rb +7 -2
- data/lib/acts_as_footprintable/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5511b19bf736e594da831847c7e5680ed541f45
|
4
|
+
data.tar.gz: 587ada66643a68366b0099661d9a3f420f373f76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b3ee4db822262a0e47e15d49959b50552bb26b7c088163fb2006341e96fc62a5a897c2d48f2b5919eca9ca9eb7d2c070e05b34efd6ff0e7edaee0856c24e02c
|
7
|
+
data.tar.gz: 266229cf82bb0245dd70a330a527cff8619ef19734fdf59b4f010eadc383eb18336b5e7bd6b68f076e0b6acc9751ae1ebd1bc41425cf248fb07d6edd0d9db063
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -5,7 +5,6 @@ source 'https://rubygems.org'
|
|
5
5
|
gemspec
|
6
6
|
|
7
7
|
rails_version = ENV['RAILS_VERSION'] || 'default'
|
8
|
-
|
9
8
|
rails = case rails_version
|
10
9
|
when 'master'
|
11
10
|
{ :github => 'rails/rails' }
|
@@ -17,5 +16,5 @@ rails = case rails_version
|
|
17
16
|
|
18
17
|
gem 'rails', rails
|
19
18
|
group :development do
|
20
|
-
gem 'combustion',
|
19
|
+
gem 'combustion', '~> 0.5'
|
21
20
|
end
|
@@ -10,8 +10,8 @@ module ActsAsFootprintable
|
|
10
10
|
belongs_to :footprintable, :polymorphic => true
|
11
11
|
belongs_to :footprinter, :polymorphic => true
|
12
12
|
|
13
|
-
scope :for_type, lambda{|klass| where(:footprintable_type => klass)}
|
14
|
-
scope :by_type, lambda{|klass| where(:footprinter_type => klass)}
|
13
|
+
scope :for_type, lambda{|klass| where(:footprintable_type => klass.name)}
|
14
|
+
scope :by_type, lambda{|klass| where(:footprinter_type => klass.name)}
|
15
15
|
|
16
16
|
validates :footprintable_id, :presence => true
|
17
17
|
validates :footprinter_id, :presence => true
|
@@ -39,8 +39,13 @@ module ActsAsFootprintable
|
|
39
39
|
|
40
40
|
def recent_footprint_ids(target, limit=nil)
|
41
41
|
recent_footprints = target.group("#{table_name}.footprintable_id, #{table_name}.footprintable_type").
|
42
|
-
select("#{table_name}.footprintable_id, #{table_name}.footprintable_type, MAX(#{table_name}.created_at)")
|
43
|
-
|
42
|
+
select("#{table_name}.footprintable_id, #{table_name}.footprintable_type, MAX(#{table_name}.created_at) AS created_at")
|
43
|
+
recent_footprints_conditions = recent_footprints.map{ |recent_footprint| recent_footprint.attributes.select{ |_, v| !v.nil?} }
|
44
|
+
columns = recent_footprints_conditions.first.keys.map{|column| "#{table_name}.#{column}" }.join(',')
|
45
|
+
values = recent_footprints_conditions.map { |row|
|
46
|
+
"(#{row.values.map{|value| ActiveRecord::Base::sanitize(value)}.join(',')})"
|
47
|
+
}.join(',')
|
48
|
+
records = footprints.where("(#{columns}) IN (#{values})")
|
44
49
|
records = records.order("footprints.created_at desc")
|
45
50
|
records = records.limit(limit) unless limit.nil?
|
46
51
|
records.pluck(:id)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toyoaki Oko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.5.
|
151
|
+
rubygems_version: 2.5.2
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Rails gem to allowing records to leave footprints
|