seofy 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,11 @@ module Seofy
22
22
  def after_create(inst)
23
23
  # do nothing
24
24
  end
25
+
26
+ def need_update_slug?
27
+ true
28
+ end
29
+
25
30
  end
26
31
  end
27
32
  end
@@ -13,6 +13,10 @@ module Seofy
13
13
  def set_seofy_slug(inst)
14
14
  end
15
15
 
16
+ def need_update_slug?
17
+ false
18
+ end
19
+
16
20
  end
17
21
  end
18
22
  end
@@ -9,13 +9,15 @@ module Seofy
9
9
  def each_model
10
10
  self.klasses.split(",").each do |class_name|
11
11
  klass = class_name.constantize
12
- yield klass if block_given?
12
+ if klass.seofy_adapter.need_update_slug?
13
+ yield klass if block_given?
14
+ end
13
15
  end
14
16
  end
15
17
 
16
18
  def update_all
17
19
  each_model do |klass|
18
- klass.find_each do |record|
20
+ klass.find_each(:select => [:id]) do |record|
19
21
  update(record)
20
22
  end
21
23
  end
@@ -23,7 +25,7 @@ module Seofy
23
25
 
24
26
  def update_null
25
27
  each_model do |klass|
26
- klass.unscoped.find_each(:conditions => ["#{klass.seofy_adapter.column} is null"]) do |record|
28
+ klass.unscoped.find_each(:select => [:id], :conditions => ["#{klass.seofy_adapter.column} is null"]) do |record|
27
29
  update(record)
28
30
  end
29
31
  end
@@ -1,3 +1,3 @@
1
1
  module Seofy
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seofy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Allen Wei