mechanize_store 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb6b4b6d040f35950c264d5a98ea73060ba62222
4
- data.tar.gz: 42adbe516fdd30539448e43c2bbb52883c8737c2
3
+ metadata.gz: b6cf4510b4cc07bf1463193454f45d617e142ef3
4
+ data.tar.gz: bde6347aca75f4b9040f3a5db456b8b2844bb3cb
5
5
  SHA512:
6
- metadata.gz: 03c859591333bb6d05ba34a6f1c798148a240f7aa2bfadb4cd9511a7bd99baa093a618093699788a91d3f7ea955de115da5342ee6395a95d902a067abfbd79f7
7
- data.tar.gz: 5d8929aad8f4a64a3ea82bb86c7e4c771a1fa5d241fdc1d3a78a64e837887f132e42d3d7839e72a562d7606985ab5759f6a05a411f9b4a59b771f68b714047a8
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
@@ -0,0 +1,5 @@
1
+ class AddSlugToProductCategory < ActiveRecord::Migration
2
+ def change
3
+ add_column :mechanize_store_product_categories, :slug, :string, index: true
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module MechanizeStore
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -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: 20140602124615) do
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|
Binary file
@@ -25618,3 +25618,9 @@ Migrating to RenameColumns (20140602124615)
25618
25618
  SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140602124615"]]
25619
25619
   (1.2ms) commit transaction
25620
25620
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
25621
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
25622
+ Migrating to AddSlugToProductCategory (20140605213358)
25623
+  (0.1ms) begin transaction
25624
+  (0.2ms) ALTER TABLE "product_categories" ADD "slug" varchar(255)
25625
+ SQLite3::SQLException: no such table: product_categories: ALTER TABLE "product_categories" ADD "slug" varchar(255)
25626
+  (0.0ms) rollback transaction