page_parts 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -22,6 +22,12 @@ Enable page parts in your model
22
22
  @category.content = "Some text"
23
23
  @category.sidebar = "Sidebar text"
24
24
  @category.save
25
+
26
+ With suffixes:
27
+
28
+ page_parts :main, :left, :sidebar, :suffix => [:ru, :en, :uk]
29
+
30
+ Generates main_ru, main_en, main_uk, left_ru ...
25
31
 
26
32
  == Test
27
33
 
@@ -1,3 +1,5 @@
1
+ require 'active_support/concern'
2
+
1
3
  module PageParts
2
4
  module ActiveRecordExtension
3
5
  extend ActiveSupport::Concern
@@ -15,21 +17,24 @@ module PageParts
15
17
  ## PageParts
16
18
  # Enable page parts in your model:
17
19
  #
18
- # page_parts :main, :left, :sidebar
20
+ # page_parts :main, :left, :sidebar, :suffix => [:ru, :en, :uk]
19
21
  #
20
22
  def page_parts(*args)
21
- options = args.extract_options!
22
-
23
- self.page_parts_definitions[:keys] += args.map(&:to_s)
23
+ options = { :suffix => [nil] }.merge(args.extract_options!)
24
24
 
25
25
  args.each do |attr_name|
26
- define_method(attr_name) do
27
- page_part(attr_name).try(:content)
28
- end
29
-
30
- define_method("#{attr_name}=") do |value|
31
- record = page_part(attr_name)
32
- record.content = value
26
+ Array.wrap(options[:suffix]).each do |suffix|
27
+ method_name = [attr_name, suffix].compact.map(&:to_s).join('_')
28
+ self.page_parts_definitions[:keys] << method_name
29
+
30
+ define_method(method_name) do
31
+ page_part(method_name).try(:content)
32
+ end
33
+
34
+ define_method("#{method_name}=") do |value|
35
+ record = page_part(method_name)
36
+ record.content = value
37
+ end
33
38
  end
34
39
  end
35
40
  end
@@ -1,3 +1,3 @@
1
1
  module PageParts
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/page_parts.rb CHANGED
@@ -1,6 +1,5 @@
1
- require 'page_parts/active_record_extension'
2
-
3
1
  module PageParts
2
+ autoload :ActiveRecordExtension, "page_parts/active_record_extension"
4
3
  end
5
4
 
6
5
  require 'page_parts/engine'
@@ -0,0 +1,5 @@
1
+ class Post < ActiveRecord::Base
2
+ include PageParts::ActiveRecordExtension
3
+
4
+ page_parts :title, :content, :suffix => [:ru, :en, :uk]
5
+ end
@@ -0,0 +1,9 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.boolean :is_visible
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
Binary file
@@ -423,3 +423,362 @@ Migrating to CreateCategories (20111226131910)
423
423
  SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Mon, 26 Dec 2011 14:20:13 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Mon, 26 Dec 2011 14:20:13 UTC +00:00]]
424
424
   (0.0ms) RELEASE SAVEPOINT active_record_1
425
425
   (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
426
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
427
+ Migrating to CreatePageParts (20111226144515)
428
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
429
+ Migrating to CreateCategories (20111226131910)
430
+  (0.1ms) SAVEPOINT active_record_1
431
+  (0.3ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
432
+ SQL (18.5ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:31:25 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:31:25 UTC +00:00]]
433
+  (0.1ms) RELEASE SAVEPOINT active_record_1
434
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
435
+  (0.1ms) SAVEPOINT active_record_1
436
+ SQL (0.6ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:31:25 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:31:25 UTC +00:00]]
437
+  (0.1ms) RELEASE SAVEPOINT active_record_1
438
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
439
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
440
+ Migrating to CreatePageParts (20111226144515)
441
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
442
+ Migrating to CreateCategories (20111226131910)
443
+  (0.1ms) SAVEPOINT active_record_1
444
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
445
+ SQL (1.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:32:27 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:32:27 UTC +00:00]]
446
+  (0.0ms) RELEASE SAVEPOINT active_record_1
447
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
448
+  (0.0ms) SAVEPOINT active_record_1
449
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:32:27 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:32:27 UTC +00:00]]
450
+  (0.0ms) RELEASE SAVEPOINT active_record_1
451
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
452
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
453
+ Migrating to CreatePageParts (20111226144515)
454
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
455
+ Migrating to CreateCategories (20111226131910)
456
+  (0.1ms) SAVEPOINT active_record_1
457
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
458
+ SQL (1.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:32:40 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:32:40 UTC +00:00]]
459
+  (0.0ms) RELEASE SAVEPOINT active_record_1
460
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
461
+  (0.0ms) SAVEPOINT active_record_1
462
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:32:40 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:32:40 UTC +00:00]]
463
+  (0.0ms) RELEASE SAVEPOINT active_record_1
464
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
465
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
466
+ Migrating to CreatePageParts (20111226144515)
467
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
468
+ Migrating to CreateCategories (20111226131910)
469
+ PagePart Load (0.3ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
470
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
471
+  (0.0ms) SAVEPOINT active_record_1
472
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
473
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
474
+ SQL (22.8ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
475
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
476
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
477
+  (0.0ms) RELEASE SAVEPOINT active_record_1
478
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 1]]
479
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
480
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
481
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
482
+  (0.0ms) SAVEPOINT active_record_1
483
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
484
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
485
+ SQL (0.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
486
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar content"], ["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
487
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
488
+  (0.0ms) RELEASE SAVEPOINT active_record_1
489
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
490
+  (0.0ms) SAVEPOINT active_record_1
491
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
492
+ SQL (0.4ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
493
+  (0.0ms) RELEASE SAVEPOINT active_record_1
494
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
495
+  (0.0ms) SAVEPOINT active_record_1
496
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:11 UTC +00:00]]
497
+  (0.0ms) RELEASE SAVEPOINT active_record_1
498
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
499
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
500
+ Migrating to CreatePageParts (20111226144515)
501
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
502
+ Migrating to CreateCategories (20111226131910)
503
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
504
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
505
+  (0.0ms) SAVEPOINT active_record_1
506
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
507
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
508
+ SQL (22.6ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
509
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
510
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
511
+  (0.0ms) RELEASE SAVEPOINT active_record_1
512
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 1]]
513
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
514
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
515
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
516
+  (0.0ms) SAVEPOINT active_record_1
517
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
518
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
519
+ SQL (0.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
520
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar content"], ["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
521
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
522
+  (0.0ms) RELEASE SAVEPOINT active_record_1
523
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
524
+  (0.0ms) SAVEPOINT active_record_1
525
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
526
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
527
+  (0.0ms) RELEASE SAVEPOINT active_record_1
528
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
529
+  (0.0ms) SAVEPOINT active_record_1
530
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:33:31 UTC +00:00]]
531
+  (0.0ms) RELEASE SAVEPOINT active_record_1
532
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
533
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
534
+ Migrating to CreatePageParts (20111226144515)
535
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
536
+ Migrating to CreateCategories (20111226131910)
537
+ Migrating to CreatePosts (20120124093705)
538
+  (0.0ms) select sqlite_version(*)
539
+  (0.4ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "is_visible" boolean, "created_at" datetime, "updated_at" datetime)
540
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120124093705')
541
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
542
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
543
+  (0.0ms) SAVEPOINT active_record_1
544
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
545
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
546
+ SQL (1.1ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
547
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
548
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
549
+  (0.0ms) RELEASE SAVEPOINT active_record_1
550
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 1]]
551
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
552
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
553
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
554
+  (0.0ms) SAVEPOINT active_record_1
555
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
556
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
557
+ SQL (0.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
558
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar content"], ["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
559
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
560
+  (0.0ms) RELEASE SAVEPOINT active_record_1
561
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
562
+  (0.0ms) SAVEPOINT active_record_1
563
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
564
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
565
+  (0.0ms) RELEASE SAVEPOINT active_record_1
566
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
567
+  (0.0ms) SAVEPOINT active_record_1
568
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:42:27 UTC +00:00]]
569
+  (0.0ms) RELEASE SAVEPOINT active_record_1
570
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
571
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
572
+ Migrating to CreatePageParts (20111226144515)
573
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
574
+ Migrating to CreateCategories (20111226131910)
575
+ Migrating to CreatePosts (20120124093705)
576
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
577
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
578
+  (0.0ms) SAVEPOINT active_record_1
579
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
580
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
581
+ SQL (1.3ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
582
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
583
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
584
+  (0.0ms) RELEASE SAVEPOINT active_record_1
585
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 1]]
586
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
587
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
588
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
589
+  (0.0ms) SAVEPOINT active_record_1
590
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
591
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
592
+ SQL (0.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
593
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar content"], ["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
594
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
595
+  (0.0ms) RELEASE SAVEPOINT active_record_1
596
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
597
+  (0.0ms) SAVEPOINT active_record_1
598
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
599
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
600
+  (0.0ms) RELEASE SAVEPOINT active_record_1
601
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
602
+  (0.0ms) SAVEPOINT active_record_1
603
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:43:40 UTC +00:00]]
604
+  (0.0ms) RELEASE SAVEPOINT active_record_1
605
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
606
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
607
+ Migrating to CreatePageParts (20111226144515)
608
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
609
+ Migrating to CreateCategories (20111226131910)
610
+ Migrating to CreatePosts (20120124093705)
611
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
612
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
613
+  (0.0ms) SAVEPOINT active_record_1
614
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
615
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
616
+ SQL (1.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
617
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
618
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
619
+  (0.0ms) RELEASE SAVEPOINT active_record_1
620
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 1]]
621
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
622
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
623
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
624
+  (0.0ms) SAVEPOINT active_record_1
625
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
626
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
627
+ SQL (0.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
628
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar content"], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
629
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
630
+  (0.0ms) RELEASE SAVEPOINT active_record_1
631
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
632
+  (0.0ms) SAVEPOINT active_record_1
633
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
634
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
635
+  (0.0ms) RELEASE SAVEPOINT active_record_1
636
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
637
+  (0.0ms) SAVEPOINT active_record_1
638
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
639
+  (0.0ms) RELEASE SAVEPOINT active_record_1
640
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
641
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_ru' LIMIT 1
642
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_ru' LIMIT 1
643
+  (0.0ms) SAVEPOINT active_record_1
644
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
645
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
646
+ SQL (0.3ms) INSERT INTO "posts" ("created_at", "is_visible", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["is_visible", true], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
647
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "title_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
648
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "content_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
649
+  (0.0ms) RELEASE SAVEPOINT active_record_1
650
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1]]
651
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_ru' LIMIT 1
652
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_en' LIMIT 1
653
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_ru' LIMIT 1
654
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
655
+  (0.0ms) SAVEPOINT active_record_1
656
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
657
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_en' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
658
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
659
+ SQL (0.2ms) INSERT INTO "posts" ("created_at", "is_visible", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["is_visible", true], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
660
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Title ru"], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "title_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
661
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Title en"], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "title_en"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
662
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00], ["key", "content_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:44:52 UTC +00:00]]
663
+  (0.1ms) RELEASE SAVEPOINT active_record_1
664
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
665
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
666
+ Migrating to CreatePageParts (20111226144515)
667
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
668
+ Migrating to CreateCategories (20111226131910)
669
+ Migrating to CreatePosts (20120124093705)
670
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
671
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
672
+  (0.0ms) SAVEPOINT active_record_1
673
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
674
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
675
+ SQL (1.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
676
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
677
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
678
+  (0.0ms) RELEASE SAVEPOINT active_record_1
679
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 1]]
680
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
681
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
682
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
683
+  (0.0ms) SAVEPOINT active_record_1
684
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
685
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
686
+ SQL (0.3ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
687
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar content"], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
688
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
689
+  (0.0ms) RELEASE SAVEPOINT active_record_1
690
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
691
+  (0.0ms) SAVEPOINT active_record_1
692
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
693
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
694
+  (0.0ms) RELEASE SAVEPOINT active_record_1
695
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
696
+  (0.0ms) SAVEPOINT active_record_1
697
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
698
+  (0.0ms) RELEASE SAVEPOINT active_record_1
699
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
700
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_ru' LIMIT 1
701
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_ru' LIMIT 1
702
+  (0.0ms) SAVEPOINT active_record_1
703
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
704
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
705
+ SQL (0.5ms) INSERT INTO "posts" ("created_at", "is_visible", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["is_visible", true], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
706
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "title_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
707
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "content_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
708
+  (0.1ms) RELEASE SAVEPOINT active_record_1
709
+ Post Load (0.2ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1]]
710
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_ru' LIMIT 1
711
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_en' LIMIT 1
712
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_ru' LIMIT 1
713
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
714
+  (0.1ms) SAVEPOINT active_record_1
715
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
716
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_en' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
717
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
718
+ SQL (0.3ms) INSERT INTO "posts" ("created_at", "is_visible", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["is_visible", true], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
719
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Title ru"], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "title_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
720
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Title en"], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "title_en"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
721
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00], ["key", "content_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:04 UTC +00:00]]
722
+  (0.0ms) RELEASE SAVEPOINT active_record_1
723
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
724
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
725
+ Migrating to CreatePageParts (20111226144515)
726
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
727
+ Migrating to CreateCategories (20111226131910)
728
+ Migrating to CreatePosts (20120124093705)
729
+ PagePart Load (0.2ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
730
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
731
+  (0.0ms) SAVEPOINT active_record_1
732
+  (0.2ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
733
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
734
+ SQL (1.2ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
735
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
736
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
737
+  (0.0ms) RELEASE SAVEPOINT active_record_1
738
+ Category Load (0.1ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = ? LIMIT 1 [["id", 1]]
739
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'sidebar' LIMIT 1
740
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Category' AND "page_parts"."key" = 'content' LIMIT 1
741
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
742
+  (0.0ms) SAVEPOINT active_record_1
743
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'sidebar' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
744
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" IS NULL) LIMIT 1
745
+ SQL (0.3ms) INSERT INTO "categories" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["title", "Test category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
746
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar content"], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "sidebar"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
747
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "content"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
748
+  (0.0ms) RELEASE SAVEPOINT active_record_1
749
+  (0.1ms) SELECT COUNT(*) FROM "page_parts" 
750
+  (0.0ms) SAVEPOINT active_record_1
751
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'somekey' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
752
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "somekey"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
753
+  (0.0ms) RELEASE SAVEPOINT active_record_1
754
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = '' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
755
+  (0.0ms) SAVEPOINT active_record_1
756
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "test"], ["partable_id", 1], ["partable_type", "Category"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
757
+  (0.0ms) RELEASE SAVEPOINT active_record_1
758
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'test' AND "page_parts"."partable_type" = 'Category' AND "page_parts"."partable_id" = 1) LIMIT 1
759
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_ru' LIMIT 1
760
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_uk' LIMIT 1
761
+  (0.0ms) SAVEPOINT active_record_1
762
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
763
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content_uk' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
764
+ SQL (0.4ms) INSERT INTO "posts" ("created_at", "is_visible", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["is_visible", true], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
765
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Sidebar"], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "title_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
766
+ SQL (0.1ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Main"], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "content_uk"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
767
+  (0.0ms) RELEASE SAVEPOINT active_record_1
768
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1]]
769
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" = 1 AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_ru' LIMIT 1
770
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" = 1 AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_en' LIMIT 1
771
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_ru' LIMIT 1
772
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'title_en' LIMIT 1
773
+ PagePart Load (0.1ms) SELECT "page_parts".* FROM "page_parts" WHERE "page_parts"."partable_id" IS NULL AND "page_parts"."partable_type" = 'Post' AND "page_parts"."key" = 'content_ru' LIMIT 1
774
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
775
+  (0.0ms) SAVEPOINT active_record_1
776
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
777
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'title_en' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
778
+  (0.1ms) SELECT 1 FROM "page_parts" WHERE ("page_parts"."key" = 'content_ru' AND "page_parts"."partable_type" = 'Post' AND "page_parts"."partable_id" IS NULL) LIMIT 1
779
+ SQL (0.3ms) INSERT INTO "posts" ("created_at", "is_visible", "updated_at") VALUES (?, ?, ?) [["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["is_visible", true], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
780
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Title ru"], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "title_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
781
+ SQL (0.2ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", "Title en"], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "title_en"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
782
+ SQL (0.3ms) INSERT INTO "page_parts" ("content", "created_at", "key", "partable_id", "partable_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["content", nil], ["created_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00], ["key", "content_ru"], ["partable_id", 1], ["partable_type", "Post"], ["updated_at", Tue, 24 Jan 2012 09:45:43 UTC +00:00]]
783
+  (0.0ms) RELEASE SAVEPOINT active_record_1
784
+  (0.1ms) SELECT COUNT(*) FROM "page_parts"
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ is_visible: false
5
+
6
+ two:
7
+ is_visible: false
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+
5
+ setup do
6
+ @post = Post.new :is_visible => true
7
+ end
8
+
9
+ test 'should has page_parts_definitions' do
10
+ assert Post.respond_to?(:page_parts_definitions)
11
+ end
12
+
13
+ test "should save page parts with new_record" do
14
+ value_ru = "Title ru"
15
+ @post.title_ru = value_ru
16
+
17
+ value_en = "Title en"
18
+ @post.title_en = value_en
19
+
20
+ assert_equal @post.page_part(:title_ru).content, value_ru
21
+ assert_equal @post.page_part(:title_en).content, value_en
22
+ assert_equal @post.page_part(:content_ru).content, nil
23
+
24
+ assert_difference('PagePart.count', 3) do
25
+ @post.save
26
+ end
27
+ end
28
+
29
+ test "should load page parts into record" do
30
+ @post.title_ru = "Sidebar"
31
+ @post.content_uk = "Main"
32
+ @post.save
33
+
34
+ @post.reload
35
+
36
+ assert_equal @post.title_ru, "Sidebar"
37
+ assert_equal @post.content_uk, "Main"
38
+ assert_equal @post.content_ru, nil
39
+ assert_equal @post.content_en, nil
40
+ end
41
+
42
+ test "should raise error on not registered page part" do
43
+ assert_raise(NoMethodError) do
44
+ @post.title
45
+ end
46
+
47
+ assert_raise(NoMethodError) do
48
+ @post.content
49
+ end
50
+ end
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_parts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-26 00:00:00.000000000 Z
12
+ date: 2012-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &77333070 !ruby/object:Gem::Requirement
16
+ requirement: &80855800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 3.1.3
21
+ version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *77333070
24
+ version_requirements: *80855800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &77332620 !ruby/object:Gem::Requirement
27
+ requirement: &80854830 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *77332620
35
+ version_requirements: *80854830
36
36
  description: Aimbulance CMS
37
37
  email:
38
38
  - galeta.igor@gmail.com
@@ -51,6 +51,7 @@ files:
51
51
  - Rakefile
52
52
  - README.rdoc
53
53
  - test/models/category_test.rb
54
+ - test/models/post_test.rb
54
55
  - test/models/page_part_test.rb
55
56
  - test/dummy/public/500.html
56
57
  - test/dummy/public/404.html
@@ -59,6 +60,7 @@ files:
59
60
  - test/dummy/app/views/layouts/application.html.erb
60
61
  - test/dummy/app/helpers/application_helper.rb
61
62
  - test/dummy/app/models/category.rb
63
+ - test/dummy/app/models/post.rb
62
64
  - test/dummy/app/assets/stylesheets/application.css
63
65
  - test/dummy/app/assets/javascripts/application.js
64
66
  - test/dummy/app/controllers/application_controller.rb
@@ -66,7 +68,9 @@ files:
66
68
  - test/dummy/log/development.log
67
69
  - test/dummy/Rakefile
68
70
  - test/dummy/test/unit/category_test.rb
71
+ - test/dummy/test/unit/post_test.rb
69
72
  - test/dummy/test/fixtures/categories.yml
73
+ - test/dummy/test/fixtures/posts.yml
70
74
  - test/dummy/script/rails
71
75
  - test/dummy/config/routes.rb
72
76
  - test/dummy/config/environments/production.rb
@@ -83,6 +87,7 @@ files:
83
87
  - test/dummy/config/initializers/wrap_parameters.rb
84
88
  - test/dummy/config/environment.rb
85
89
  - test/dummy/config/locales/en.yml
90
+ - test/dummy/db/migrate/20120124093705_create_posts.rb
86
91
  - test/dummy/db/migrate/20111226131910_create_categories.rb
87
92
  - test/dummy/db/test.sqlite3
88
93
  - test/dummy/config.ru
@@ -114,6 +119,7 @@ specification_version: 3
114
119
  summary: Easy way to setup and use different page parts.
115
120
  test_files:
116
121
  - test/models/category_test.rb
122
+ - test/models/post_test.rb
117
123
  - test/models/page_part_test.rb
118
124
  - test/dummy/public/500.html
119
125
  - test/dummy/public/404.html
@@ -122,6 +128,7 @@ test_files:
122
128
  - test/dummy/app/views/layouts/application.html.erb
123
129
  - test/dummy/app/helpers/application_helper.rb
124
130
  - test/dummy/app/models/category.rb
131
+ - test/dummy/app/models/post.rb
125
132
  - test/dummy/app/assets/stylesheets/application.css
126
133
  - test/dummy/app/assets/javascripts/application.js
127
134
  - test/dummy/app/controllers/application_controller.rb
@@ -129,7 +136,9 @@ test_files:
129
136
  - test/dummy/log/development.log
130
137
  - test/dummy/Rakefile
131
138
  - test/dummy/test/unit/category_test.rb
139
+ - test/dummy/test/unit/post_test.rb
132
140
  - test/dummy/test/fixtures/categories.yml
141
+ - test/dummy/test/fixtures/posts.yml
133
142
  - test/dummy/script/rails
134
143
  - test/dummy/config/routes.rb
135
144
  - test/dummy/config/environments/production.rb
@@ -146,6 +155,7 @@ test_files:
146
155
  - test/dummy/config/initializers/wrap_parameters.rb
147
156
  - test/dummy/config/environment.rb
148
157
  - test/dummy/config/locales/en.yml
158
+ - test/dummy/db/migrate/20120124093705_create_posts.rb
149
159
  - test/dummy/db/migrate/20111226131910_create_categories.rb
150
160
  - test/dummy/db/test.sqlite3
151
161
  - test/dummy/config.ru