mechanize_store 0.0.12 → 0.0.13
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.
- checksums.yaml +4 -4
- data/app/models/mechanize_store/product_category.rb +11 -0
- data/db/migrate/20140605213358_add_slug_to_product_category.rb +5 -0
- data/lib/mechanize_store/version.rb +1 -1
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +6 -0
- data/spec/dummy/log/test.log +1437 -0
- data/spec/dummy/public/photos/1/medium.png +0 -0
- data/spec/dummy/public/photos/1/thumb.png +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6cf4510b4cc07bf1463193454f45d617e142ef3
|
4
|
+
data.tar.gz: bde6347aca75f4b9040f3a5db456b8b2844bb3cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 974bc6f020e273d2f369d13b84144c4e3dce8dc92cea6c13197a57ebba3f272a6a28b31388c316325833ca00a80ec93d2736fe4b6329a4dd8e76be0c011f64a6
|
7
|
+
data.tar.gz: b1991b66f17011754b88eafbe8c12aeec9ced472a97358944a34d24b48724fb93c3555ed1dd6620a25feb9d2d381439d066b0ff4b159abf3f77701445af4c321
|
@@ -6,5 +6,16 @@ module MechanizeStore
|
|
6
6
|
validates :name, presence: true
|
7
7
|
|
8
8
|
scope :orphans, -> { where("product_category_id is NULL") }
|
9
|
+
|
10
|
+
after_create :create_slug
|
11
|
+
before_update :set_defaults
|
12
|
+
|
13
|
+
def set_defaults
|
14
|
+
self.slug = self.name.parameterize
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_slug
|
18
|
+
self.update_attributes(:slug => self.name.parameterize)
|
19
|
+
end
|
9
20
|
end
|
10
21
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20140605213358) do
|
15
15
|
|
16
16
|
create_table "mechanize_store_flags", force: true do |t|
|
17
17
|
t.string "name"
|
@@ -76,6 +76,7 @@ ActiveRecord::Schema.define(version: 20140602124615) do
|
|
76
76
|
t.integer "product_category_id"
|
77
77
|
t.datetime "created_at"
|
78
78
|
t.datetime "updated_at"
|
79
|
+
t.string "slug"
|
79
80
|
end
|
80
81
|
|
81
82
|
create_table "mechanize_store_product_photos", force: true do |t|
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -25618,3 +25618,9 @@ Migrating to RenameColumns (20140602124615)
|
|
25618
25618
|
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140602124615"]]
|
25619
25619
|
[1m[35m (1.2ms)[0m commit transaction
|
25620
25620
|
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
25621
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
25622
|
+
Migrating to AddSlugToProductCategory (20140605213358)
|
25623
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25624
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "product_categories" ADD "slug" varchar(255)[0m
|
25625
|
+
SQLite3::SQLException: no such table: product_categories: ALTER TABLE "product_categories" ADD "slug" varchar(255)
|
25626
|
+
[1m[35m (0.0ms)[0m rollback transaction
|