seofy 0.1.2 → 0.1.3

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.
@@ -17,7 +17,7 @@ module Seofy
17
17
 
18
18
  def update_all
19
19
  each_model do |klass|
20
- klass.find_each(:select => [:id]) do |record|
20
+ klass.unscoped.find_each(:select => [:id]) do |record|
21
21
  update(record)
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Seofy
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -10,20 +10,28 @@ describe Seofy::TaskRunner do
10
10
 
11
11
  describe "#update_all" do
12
12
  it "should update all slugs" do
13
- s1 = Store.create!("store 1")
13
+ s1 = Store.create!(:title => "store 1")
14
14
  slug1 = s1.slug
15
15
  ENV["MODELS"] = "Store"
16
16
  Seofy::TaskRunner.new.update_all
17
17
  s1.reload.should_not == slug1
18
18
  end
19
+ it "should ignore default_scope" do
20
+ s1 = Store.create!(:title => "store 1", :deleted => 1)
21
+ slug1 = s1.slug
22
+ ENV["MODELS"] = "Store"
23
+ Seofy::TaskRunner.new.update_all
24
+ Store.unscoped.find(s1.id).reload.should_not == slug1
25
+
26
+ end
19
27
  end
20
28
 
21
29
  describe "#update_null" do
22
30
  it "should update all null slugs" do
23
- s1 = Store.create!("store 1")
31
+ s1 = Store.create!(:title => "store 1")
24
32
  Store.connection.execute("update stores set slug = NULL")
25
33
  s1.reload.slug.should be_nil
26
- s2 = Store.create!("store 1")
34
+ s2 = Store.create!(:title => "store 1")
27
35
  old_slug = s2.slug
28
36
  ENV["MODELS"] = "Store"
29
37
  Seofy::TaskRunner.new.update_all
@@ -6,4 +6,5 @@ end
6
6
  # base36 adapter
7
7
  class Store < ActiveRecord::Base
8
8
  seofy :source => :title, :adapter => :base36, :adapter_option => {:length => 3, :column => :slug }
9
+ default_scope where("stores.deleted = 0")
9
10
  end
@@ -8,6 +8,7 @@ class CreateModels < ActiveRecord::Migration
8
8
  create_table :stores, :force => true do |t|
9
9
  t.string :title
10
10
  t.string :slug
11
+ t.integer :deleted, :default => 0
11
12
  end
12
13
 
13
14
  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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Allen Wei