translatable_records 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 853fe418c0b123941ce33d64f67872df5045cc6b
4
- data.tar.gz: a2cc5c10f08c42a2eb29eebaafbabd035fad64eb
3
+ metadata.gz: 0929838911d0ef7b67521a3dc3e731399c7308d1
4
+ data.tar.gz: d59d23519e18fae7a7677fac1fb79c8c52aebd91
5
5
  SHA512:
6
- metadata.gz: 166139b74c3c6bde0cfb6a34efc762c230914338b303ce5252a43ffa46d87f3ccd1dbe2112785295da21aa3c7fe38e4eba1d27343a5924650e380b6e3ab45238
7
- data.tar.gz: ed33fe2d31a05cff0ec299e2ad1d11fcd052a7e92036ec381da566053f8287c1141ae0294a106525cc12ddfb52fa54192799f29aa416eef7e74d4446dfb86b9d
6
+ metadata.gz: f3c3ebb93a7cf507e188a7c47f79da42f77fb1adf5e259e97d6c73e4f50e5646880987ca60251ec9a2ef61bb9fb131cae0186154e6c0b1457252eff47997d3b7
7
+ data.tar.gz: 300da5f33bb39aee6f67c6ec9dbc1d52ee5e34ba36b6261d9cb5d34781264da29197c0504e0b18027cb1bcfc020e7d7b2ebda47dd887cfcebcf34a45d8eb95ad
data/README.rdoc CHANGED
@@ -1,49 +1,55 @@
1
- {<img src="https://badge.fury.io/rb/translatable_records.png" alt="Gem Version" />}[http://badge.fury.io/rb/translatable_records] {<img src="https://codeclimate.com/github/museways/translatable_records.png" />}[https://codeclimate.com/github/museways/translatable_records] {<img src="https://secure.travis-ci.org/museways/translatable_records.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/translatable_records] {<img src="https://gemnasium.com/museways/translatable_records.png" alt="Dependency Status" />}[https://gemnasium.com/museways/translatable_records]
1
+ {<img src="https://badge.fury.io/rb/translatable_records.png" alt="Gem Version" />}[http://badge.fury.io/rb/translatable_records] {<img src="https://codeclimate.com/github/museways/translatable_records.png" />}[https://codeclimate.com/github/museways/translatable_records] {<img src="https://secure.travis-ci.org/museways/translatable_records.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/translatable_records]
2
2
 
3
3
  = Translatable Records
4
4
 
5
- Everything you need to work with translatable records.
5
+ Minimalistic toolkit to work with translatable records in rails.
6
6
 
7
7
  = Install
8
8
 
9
9
  Put this line in your Gemfile:
10
10
  gem 'translatable_records'
11
-
11
+
12
12
  Then bundle:
13
13
  $ bundle
14
-
15
- = Usage
16
14
 
17
- First define the model and set the name of the fields you want to translate with the attr_translatable method:
15
+ = Configuration
16
+
17
+ Define wich attributes will be translatable with the attr_translatable in your models:
18
18
  attr_translatable :attr
19
19
 
20
- (If you are using rails 3 you should add attr_accessible :attr to pass the atrr to create, update, etc)
20
+ Generate the translation model and migration for them:
21
+ rails g translation model
22
+
23
+ Complete the migrations adding the columns for each field in the translatations tables:
24
+ add_column :model_translations, :attr, :string
25
+
26
+ Remove the original column from models table:
27
+ remove_column :model, :attr
21
28
 
22
- Generate the translation model and migration for that model:
23
- rails g translation Model
24
-
25
- Update the translation migration with the column for that field and remove the column from the original table:
26
- t.string :attr
27
-
28
29
  Update your db:
29
30
  rake db:migrate
30
-
31
+
32
+ NOTE: If you are using rails 3 you should add attr_accessible :attr to pass the atrr to create, update, etc.
33
+
34
+ = Usage
35
+
31
36
  If you want to change the locale to something different than I18n.locale:
32
37
  record.with_locale :es
33
38
 
34
39
  If you want to build a translation for each available locale:
35
40
  record.build_translations
36
-
41
+
37
42
  If you want to save multiple translations:
38
- <%= f.fields_for 'translations_attributes[]', t do |ff| %>
39
- <%= field_set_tag t("locales.#{t.locale}") do %>
40
- <% unless t.new_record? %>
41
- <%= ff.hidden_field :id %>
42
- <% end %>
43
- <%= ff.hidden_field :locale %>
44
- <li>
45
- <%= ff.label :attr %>
46
- <%= ff.text_field :attr %>
47
- </li>
48
- <% end %>
43
+ <%= f.fields_for :translations do |ff| %>
44
+ <%= ff.hidden_field :locale %>
45
+ <%= ff.label :attr %>
46
+ <%= ff.text_field :attr %>
49
47
  <% end %>
48
+
49
+ = Credits
50
+
51
+ This gem is maintained and funded by museways[http://museways.com].
52
+
53
+ = License
54
+
55
+ It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
@@ -4,7 +4,7 @@ class <%= "Create#{singular_name.camelize}Translations" %> < ActiveRecord::Migra
4
4
  t.integer <%= ":#{singular_table_name}_id" %>
5
5
  t.string :locale
6
6
 
7
- t.timestamps
7
+ t.timestamps
8
8
  end
9
9
  add_index <%= ":#{singular_table_name}_translations" %>, <%= ":#{singular_table_name}_id" %>
10
10
  add_index <%= ":#{singular_table_name}_translations" %>, :locale
@@ -1,6 +1,6 @@
1
1
  class <%= "#{class_name}Translation" %> < ActiveRecord::Base
2
2
 
3
- belongs_to <%= ":#{table_name}" %>
3
+ belongs_to <%= ":#{singular_table_name}" %>
4
4
 
5
5
  validates :locale, presence: true
6
6
  validates <%= ":#{singular_table_name}_id" %>, uniqueness: { scope: :locale }
@@ -4,18 +4,18 @@ class TranslationGenerator < Rails::Generators::NamedBase
4
4
  include Rails::Generators::Migration
5
5
 
6
6
  source_root File.expand_path('../templates', __FILE__)
7
-
7
+
8
8
  def create_translation_model
9
9
  @model = Object.const_get(class_name)
10
10
  template 'model.rb', "app/models/#{file_name}_translation.rb"
11
11
  end
12
-
12
+
13
13
  def create_translation_migration
14
14
  migration_template 'migration.rb', "db/migrate/create_#{singular_table_name}_translations.rb"
15
15
  end
16
-
16
+
17
17
  def self.next_migration_number(path)
18
18
  Time.now.utc.strftime '%Y%m%d%H%M%S'
19
- end
20
-
19
+ end
20
+
21
21
  end
@@ -1,7 +1,6 @@
1
1
  require 'translatable_records/active_record/base'
2
2
  require 'translatable_records/active_record/translatable'
3
3
  require 'translatable_records/railtie'
4
- require 'translatable_records/version'
5
4
 
6
5
  module TranslatableRecords
7
6
  end
@@ -2,13 +2,12 @@ module TranslatableRecords
2
2
  module ActiveRecord
3
3
  module Base
4
4
  extend ActiveSupport::Concern
5
-
6
5
  module ClassMethods
7
6
 
8
7
  def translatable?
9
8
  translatable_attrs.any?
10
9
  end
11
-
10
+
12
11
  def translatable_attrs
13
12
  @translatable_attrs ||= []
14
13
  end
@@ -2,25 +2,25 @@ module TranslatableRecords
2
2
  module ActiveRecord
3
3
  module Translatable
4
4
  extend ActiveSupport::Concern
5
-
5
+
6
6
  def with_locale(locale)
7
7
  @current_locale = locale.to_sym
8
8
  end
9
-
9
+
10
10
  def build_translations
11
11
  I18n.available_locales.each { |locale| translations.build locale: locale.to_s unless translations.find_by_locale(locale) }
12
12
  end
13
-
13
+
14
14
  protected
15
-
15
+
16
16
  def current_locale
17
17
  @current_locale || I18n.locale
18
18
  end
19
-
19
+
20
20
  def translation_by_locale(locale)
21
21
  translations.to_a.find { |t| t.locale == locale.to_s } || translations.find_by_locale(locale)
22
22
  end
23
-
23
+
24
24
  end
25
25
  end
26
26
  end
@@ -1,5 +1,5 @@
1
1
  module TranslatableRecords
2
2
 
3
- VERSION = '1.1.1'
3
+ VERSION = '1.1.2'
4
4
 
5
5
  end
@@ -1,8 +1,8 @@
1
1
  class ModelTranslation < ActiveRecord::Base
2
-
2
+
3
3
  belongs_to :models
4
-
4
+
5
5
  validates :locale, presence: true
6
6
  validates :model_id, uniqueness: { scope: :locale }
7
-
7
+
8
8
  end
@@ -3477,3 +3477,388 @@ RecrodsTest: test_should_edit_associated_translation
3477
3477
   (0.1ms) SELECT 1 FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."id" != 1 AND "model_translations"."locale" = 'en') LIMIT 1
3478
3478
   (0.1ms) UPDATE "model_translations" SET "name" = 'new name', "updated_at" = '2014-06-09 18:26:46.135758' WHERE "model_translations"."id" = 1
3479
3479
   (0.0ms) RELEASE SAVEPOINT active_record_1
3480
+  (0.3ms) CREATE TABLE "model_translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_id" integer, "locale" varchar(255), "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
3481
+  (0.1ms) select sqlite_version(*)
3482
+  (0.2ms) CREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")
3483
+  (0.1ms) SELECT sql
3484
+ FROM sqlite_master
3485
+ WHERE name='index_model_translations_on_locale' AND type='index'
3486
+ UNION ALL
3487
+ SELECT sql
3488
+ FROM sqlite_temp_master
3489
+ WHERE name='index_model_translations_on_locale' AND type='index'
3490
+
3491
+  (0.1ms) CREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")
3492
+  (0.2ms) CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
3493
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
3494
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3495
+  (0.1ms) SELECT version FROM "schema_migrations"
3496
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
3497
+  (0.1ms) begin transaction
3498
+ --------------------------------------
3499
+ I18nGeneratorTest: test_generate_files
3500
+ --------------------------------------
3501
+  (0.1ms) rollback transaction
3502
+  (0.0ms) begin transaction
3503
+ --------------------------------
3504
+ RecordsTest: test_change_locales
3505
+ --------------------------------
3506
+  (0.1ms) SAVEPOINT active_record_1
3507
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3508
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:06.165692"], ["updated_at", "2014-06-25 02:02:06.165692"]]
3509
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:06.168141"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:06.168141"]]
3510
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3511
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3512
+ ModelTranslation Load (0.0ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3513
+  (0.0ms) SAVEPOINT active_record_1
3514
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
3515
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:06.172379"], ["locale", "es"], ["model_id", 1], ["name", "new name"], ["updated_at", "2014-06-25 02:02:06.172379"]]
3516
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3517
+  (0.0ms) rollback transaction
3518
+  (0.0ms) begin transaction
3519
+ -----------------------------------------------
3520
+ RecordsTest: test_create_associated_translation
3521
+ -----------------------------------------------
3522
+  (0.0ms) SAVEPOINT active_record_1
3523
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3524
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:06.175525"], ["updated_at", "2014-06-25 02:02:06.175525"]]
3525
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:06.176139"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:06.176139"]]
3526
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3527
+  (0.0ms) rollback transaction
3528
+  (0.0ms) begin transaction
3529
+ -----------------------------------------------
3530
+ RecordsTest: test_delete_associated_translation
3531
+ -----------------------------------------------
3532
+  (0.0ms) SAVEPOINT active_record_1
3533
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3534
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:06.178951"], ["updated_at", "2014-06-25 02:02:06.178951"]]
3535
+ SQL (0.0ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:06.179597"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:06.179597"]]
3536
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3537
+  (0.0ms) SAVEPOINT active_record_1
3538
+ SQL (0.1ms) DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
3539
+ SQL (0.1ms) DELETE FROM "models" WHERE "models"."id" = ? [["id", 1]]
3540
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3541
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1
3542
+  (0.0ms) rollback transaction
3543
+  (0.1ms) begin transaction
3544
+ ---------------------------------------------
3545
+ RecordsTest: test_edit_associated_translation
3546
+ ---------------------------------------------
3547
+  (0.0ms) SAVEPOINT active_record_1
3548
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3549
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:06.183507"], ["updated_at", "2014-06-25 02:02:06.183507"]]
3550
+ SQL (0.0ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:06.184069"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:06.184069"]]
3551
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3552
+  (0.0ms) SAVEPOINT active_record_1
3553
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."id" != 1 AND "model_translations"."locale" = 'en') LIMIT 1
3554
+ SQL (0.1ms) UPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1 [["name", "new name"], ["updated_at", "2014-06-25 02:02:06.185945"]]
3555
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3556
+  (0.0ms) rollback transaction
3557
+  (0.3ms) CREATE TABLE "model_translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_id" integer, "locale" varchar(255), "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
3558
+  (0.1ms) select sqlite_version(*)
3559
+  (0.1ms) CREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")
3560
+  (0.1ms) SELECT sql
3561
+ FROM sqlite_master
3562
+ WHERE name='index_model_translations_on_locale' AND type='index'
3563
+ UNION ALL
3564
+ SELECT sql
3565
+ FROM sqlite_temp_master
3566
+ WHERE name='index_model_translations_on_locale' AND type='index'
3567
+
3568
+  (0.1ms) CREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")
3569
+  (0.1ms) CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
3570
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
3571
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3572
+  (0.0ms) SELECT version FROM "schema_migrations"
3573
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
3574
+  (0.1ms) begin transaction
3575
+ --------------------------------------
3576
+ I18nGeneratorTest: test_generate_files
3577
+ --------------------------------------
3578
+  (0.1ms) rollback transaction
3579
+  (0.0ms) begin transaction
3580
+ --------------------------------
3581
+ RecordsTest: test_change_locales
3582
+ --------------------------------
3583
+  (0.1ms) SAVEPOINT active_record_1
3584
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3585
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:38.804190"], ["updated_at", "2014-06-25 02:02:38.804190"]]
3586
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:38.807051"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:38.807051"]]
3587
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3588
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3589
+ ModelTranslation Load (0.0ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3590
+  (0.1ms) SAVEPOINT active_record_1
3591
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
3592
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:38.811819"], ["locale", "es"], ["model_id", 1], ["name", "new name"], ["updated_at", "2014-06-25 02:02:38.811819"]]
3593
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3594
+  (0.1ms) rollback transaction
3595
+  (0.0ms) begin transaction
3596
+ -----------------------------------------------
3597
+ RecordsTest: test_create_associated_translation
3598
+ -----------------------------------------------
3599
+  (0.0ms) SAVEPOINT active_record_1
3600
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3601
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:38.814705"], ["updated_at", "2014-06-25 02:02:38.814705"]]
3602
+ SQL (0.0ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:38.815295"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:38.815295"]]
3603
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3604
+  (0.1ms) rollback transaction
3605
+  (0.1ms) begin transaction
3606
+ -----------------------------------------------
3607
+ RecordsTest: test_delete_associated_translation
3608
+ -----------------------------------------------
3609
+  (0.0ms) SAVEPOINT active_record_1
3610
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3611
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:38.817880"], ["updated_at", "2014-06-25 02:02:38.817880"]]
3612
+ SQL (0.0ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:38.818484"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:38.818484"]]
3613
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3614
+  (0.0ms) SAVEPOINT active_record_1
3615
+ SQL (0.1ms) DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
3616
+ SQL (0.1ms) DELETE FROM "models" WHERE "models"."id" = ? [["id", 1]]
3617
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3618
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1
3619
+  (0.0ms) rollback transaction
3620
+  (0.0ms) begin transaction
3621
+ ---------------------------------------------
3622
+ RecordsTest: test_edit_associated_translation
3623
+ ---------------------------------------------
3624
+  (0.0ms) SAVEPOINT active_record_1
3625
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3626
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:02:38.822587"], ["updated_at", "2014-06-25 02:02:38.822587"]]
3627
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:02:38.823272"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:02:38.823272"]]
3628
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3629
+  (0.0ms) SAVEPOINT active_record_1
3630
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."id" != 1 AND "model_translations"."locale" = 'en') LIMIT 1
3631
+ SQL (0.1ms) UPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1 [["name", "new name"], ["updated_at", "2014-06-25 02:02:38.825459"]]
3632
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3633
+  (0.0ms) rollback transaction
3634
+  (0.3ms) CREATE TABLE "model_translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_id" integer, "locale" varchar(255), "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
3635
+  (0.1ms) select sqlite_version(*)
3636
+  (0.1ms) CREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")
3637
+  (0.1ms) SELECT sql
3638
+ FROM sqlite_master
3639
+ WHERE name='index_model_translations_on_locale' AND type='index'
3640
+ UNION ALL
3641
+ SELECT sql
3642
+ FROM sqlite_temp_master
3643
+ WHERE name='index_model_translations_on_locale' AND type='index'
3644
+
3645
+  (0.1ms) CREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")
3646
+  (0.1ms) CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
3647
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
3648
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3649
+  (0.1ms) SELECT version FROM "schema_migrations"
3650
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
3651
+  (0.1ms) begin transaction
3652
+ --------------------------------
3653
+ RecordsTest: test_change_locales
3654
+ --------------------------------
3655
+  (0.1ms) SAVEPOINT active_record_1
3656
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3657
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:04:42.403686"], ["updated_at", "2014-06-25 02:04:42.403686"]]
3658
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:04:42.406172"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:04:42.406172"]]
3659
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3660
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3661
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3662
+  (0.0ms) SAVEPOINT active_record_1
3663
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
3664
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:04:42.410797"], ["locale", "es"], ["model_id", 1], ["name", "new name"], ["updated_at", "2014-06-25 02:04:42.410797"]]
3665
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3666
+  (0.1ms) rollback transaction
3667
+  (0.0ms) begin transaction
3668
+ -----------------------------------------------
3669
+ RecordsTest: test_create_associated_translation
3670
+ -----------------------------------------------
3671
+  (0.0ms) SAVEPOINT active_record_1
3672
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3673
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:04:42.413750"], ["updated_at", "2014-06-25 02:04:42.413750"]]
3674
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:04:42.414344"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:04:42.414344"]]
3675
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3676
+  (0.0ms) rollback transaction
3677
+  (0.1ms) begin transaction
3678
+ -----------------------------------------------
3679
+ RecordsTest: test_delete_associated_translation
3680
+ -----------------------------------------------
3681
+  (0.0ms) SAVEPOINT active_record_1
3682
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3683
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:04:42.416828"], ["updated_at", "2014-06-25 02:04:42.416828"]]
3684
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:04:42.417379"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:04:42.417379"]]
3685
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3686
+  (0.0ms) SAVEPOINT active_record_1
3687
+ SQL (0.1ms) DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
3688
+ SQL (0.1ms) DELETE FROM "models" WHERE "models"."id" = ? [["id", 1]]
3689
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3690
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1
3691
+  (0.0ms) rollback transaction
3692
+  (0.0ms) begin transaction
3693
+ ---------------------------------------------
3694
+ RecordsTest: test_edit_associated_translation
3695
+ ---------------------------------------------
3696
+  (0.0ms) SAVEPOINT active_record_1
3697
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3698
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:04:42.421389"], ["updated_at", "2014-06-25 02:04:42.421389"]]
3699
+ SQL (0.0ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:04:42.421959"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:04:42.421959"]]
3700
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3701
+  (0.0ms) SAVEPOINT active_record_1
3702
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."id" != 1 AND "model_translations"."locale" = 'en') LIMIT 1
3703
+ SQL (0.1ms) UPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1 [["name", "new name"], ["updated_at", "2014-06-25 02:04:42.423855"]]
3704
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3705
+  (0.1ms) rollback transaction
3706
+  (0.0ms) begin transaction
3707
+ --------------------------------------
3708
+ I18nGeneratorTest: test_generate_files
3709
+ --------------------------------------
3710
+  (0.1ms) rollback transaction
3711
+  (0.3ms) CREATE TABLE "model_translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_id" integer, "locale" varchar(255), "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
3712
+  (0.1ms) select sqlite_version(*)
3713
+  (0.1ms) CREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")
3714
+  (0.1ms) SELECT sql
3715
+ FROM sqlite_master
3716
+ WHERE name='index_model_translations_on_locale' AND type='index'
3717
+ UNION ALL
3718
+ SELECT sql
3719
+ FROM sqlite_temp_master
3720
+ WHERE name='index_model_translations_on_locale' AND type='index'
3721
+
3722
+  (0.1ms) CREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")
3723
+  (0.1ms) CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
3724
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
3725
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3726
+  (0.0ms) SELECT version FROM "schema_migrations"
3727
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
3728
+  (0.1ms) begin transaction
3729
+ --------------------------------
3730
+ RecordsTest: test_change_locales
3731
+ --------------------------------
3732
+  (0.0ms) SAVEPOINT active_record_1
3733
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3734
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:05:09.214306"], ["updated_at", "2014-06-25 02:05:09.214306"]]
3735
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:05:09.216634"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:05:09.216634"]]
3736
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3737
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3738
+ ModelTranslation Load (0.0ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3739
+  (0.1ms) SAVEPOINT active_record_1
3740
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
3741
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:05:09.220855"], ["locale", "es"], ["model_id", 1], ["name", "new name"], ["updated_at", "2014-06-25 02:05:09.220855"]]
3742
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3743
+  (0.1ms) rollback transaction
3744
+  (0.0ms) begin transaction
3745
+ -----------------------------------------------
3746
+ RecordsTest: test_create_associated_translation
3747
+ -----------------------------------------------
3748
+  (0.0ms) SAVEPOINT active_record_1
3749
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3750
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:05:09.223631"], ["updated_at", "2014-06-25 02:05:09.223631"]]
3751
+ SQL (0.0ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:05:09.224195"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:05:09.224195"]]
3752
+  (0.1ms) RELEASE SAVEPOINT active_record_1
3753
+  (0.0ms) rollback transaction
3754
+  (0.0ms) begin transaction
3755
+ -----------------------------------------------
3756
+ RecordsTest: test_delete_associated_translation
3757
+ -----------------------------------------------
3758
+  (0.0ms) SAVEPOINT active_record_1
3759
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3760
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:05:09.226610"], ["updated_at", "2014-06-25 02:05:09.226610"]]
3761
+ SQL (0.0ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:05:09.227165"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:05:09.227165"]]
3762
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3763
+  (0.0ms) SAVEPOINT active_record_1
3764
+ SQL (0.1ms) DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
3765
+ SQL (0.0ms) DELETE FROM "models" WHERE "models"."id" = ? [["id", 1]]
3766
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3767
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1
3768
+  (0.0ms) rollback transaction
3769
+  (0.0ms) begin transaction
3770
+ ---------------------------------------------
3771
+ RecordsTest: test_edit_associated_translation
3772
+ ---------------------------------------------
3773
+  (0.0ms) SAVEPOINT active_record_1
3774
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3775
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-06-25 02:05:09.230986"], ["updated_at", "2014-06-25 02:05:09.230986"]]
3776
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-25 02:05:09.231562"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-06-25 02:05:09.231562"]]
3777
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3778
+  (0.0ms) SAVEPOINT active_record_1
3779
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."id" != 1 AND "model_translations"."locale" = 'en') LIMIT 1
3780
+ SQL (0.1ms) UPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1 [["name", "new name"], ["updated_at", "2014-06-25 02:05:09.233370"]]
3781
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3782
+  (0.0ms) rollback transaction
3783
+  (0.0ms) begin transaction
3784
+ --------------------------------------
3785
+ I18nGeneratorTest: test_generate_files
3786
+ --------------------------------------
3787
+  (0.1ms) rollback transaction
3788
+  (0.3ms) CREATE TABLE "model_translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_id" integer, "locale" varchar(255), "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
3789
+  (0.1ms) select sqlite_version(*)
3790
+  (0.2ms) CREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")
3791
+  (0.1ms) SELECT sql
3792
+ FROM sqlite_master
3793
+ WHERE name='index_model_translations_on_locale' AND type='index'
3794
+ UNION ALL
3795
+ SELECT sql
3796
+ FROM sqlite_temp_master
3797
+ WHERE name='index_model_translations_on_locale' AND type='index'
3798
+
3799
+  (0.1ms) CREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")
3800
+  (0.1ms) CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
3801
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
3802
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3803
+  (0.0ms) SELECT version FROM "schema_migrations"
3804
+  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
3805
+  (0.1ms) begin transaction
3806
+ -----------------------------------
3807
+ GeneratorsTest: test_generate_files
3808
+ -----------------------------------
3809
+  (0.1ms) rollback transaction
3810
+  (0.0ms) begin transaction
3811
+ --------------------------------
3812
+ RecordsTest: test_change_locales
3813
+ --------------------------------
3814
+  (0.1ms) SAVEPOINT active_record_1
3815
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3816
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-07-23 13:40:16.683094"], ["updated_at", "2014-07-23 13:40:16.683094"]]
3817
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-07-23 13:40:16.686570"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-07-23 13:40:16.686570"]]
3818
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3819
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3820
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
3821
+  (0.1ms) SAVEPOINT active_record_1
3822
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
3823
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-07-23 13:40:16.692128"], ["locale", "es"], ["model_id", 1], ["name", "new name"], ["updated_at", "2014-07-23 13:40:16.692128"]]
3824
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3825
+  (0.1ms) rollback transaction
3826
+  (0.0ms) begin transaction
3827
+ -----------------------------------------------
3828
+ RecordsTest: test_create_associated_translation
3829
+ -----------------------------------------------
3830
+  (0.0ms) SAVEPOINT active_record_1
3831
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3832
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-07-23 13:40:16.695153"], ["updated_at", "2014-07-23 13:40:16.695153"]]
3833
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-07-23 13:40:16.695808"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-07-23 13:40:16.695808"]]
3834
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3835
+  (0.1ms) rollback transaction
3836
+  (0.0ms) begin transaction
3837
+ -----------------------------------------------
3838
+ RecordsTest: test_delete_associated_translation
3839
+ -----------------------------------------------
3840
+  (0.0ms) SAVEPOINT active_record_1
3841
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3842
+ SQL (0.0ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-07-23 13:40:16.698598"], ["updated_at", "2014-07-23 13:40:16.698598"]]
3843
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-07-23 13:40:16.699208"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-07-23 13:40:16.699208"]]
3844
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3845
+  (0.0ms) SAVEPOINT active_record_1
3846
+ SQL (0.1ms) DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
3847
+ SQL (0.1ms) DELETE FROM "models" WHERE "models"."id" = ? [["id", 1]]
3848
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3849
+ ModelTranslation Load (0.1ms) SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1
3850
+  (0.0ms) rollback transaction
3851
+  (0.0ms) begin transaction
3852
+ ---------------------------------------------
3853
+ RecordsTest: test_edit_associated_translation
3854
+ ---------------------------------------------
3855
+  (0.0ms) SAVEPOINT active_record_1
3856
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
3857
+ SQL (0.1ms) INSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2014-07-23 13:40:16.703685"], ["updated_at", "2014-07-23 13:40:16.703685"]]
3858
+ SQL (0.1ms) INSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-07-23 13:40:16.704335"], ["locale", "en"], ["model_id", 1], ["name", "name"], ["updated_at", "2014-07-23 13:40:16.704335"]]
3859
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3860
+  (0.0ms) SAVEPOINT active_record_1
3861
+ ModelTranslation Exists (0.1ms) SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."id" != 1 AND "model_translations"."locale" = 'en') LIMIT 1
3862
+ SQL (0.1ms) UPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1 [["name", "new name"], ["updated_at", "2014-07-23 13:40:16.706625"]]
3863
+  (0.0ms) RELEASE SAVEPOINT active_record_1
3864
+  (0.1ms) rollback transaction
@@ -2,19 +2,19 @@ require 'test_helper'
2
2
  require 'rails/generators'
3
3
  require 'generators/translation_generator'
4
4
 
5
- class I18nGeneratorTest < Rails::Generators::TestCase
5
+ class GeneratorsTest < Rails::Generators::TestCase
6
6
 
7
- setup do
8
- FileUtils.rm_rf(self.destination_root)
7
+ teardown do
8
+ FileUtils.rm_rf self.destination_root
9
9
  end
10
-
10
+
11
11
  tests TranslationGenerator
12
12
  destination File.expand_path('../tmp', File.dirname(__FILE__))
13
-
14
- test "should generate files" do
13
+
14
+ test "generate files" do
15
15
  run_generator %w(model)
16
16
  assert_file 'app/models/model_translation.rb'
17
- assert_migration 'db/migrate/create_model_translations.rb'
17
+ assert_migration 'db/migrate/create_model_translations.rb'
18
18
  end
19
-
19
+
20
20
  end
data/test/records_test.rb CHANGED
@@ -1,23 +1,23 @@
1
1
  require 'test_helper'
2
2
 
3
- class RecrodsTest < ActiveSupport::TestCase
3
+ class RecordsTest < ActiveSupport::TestCase
4
4
 
5
- test "should create associated translation" do
5
+ test "create associated translation" do
6
6
  assert_equal 'name', record.name
7
7
  end
8
8
 
9
- test "should edit associated translation" do
9
+ test "edit associated translation" do
10
10
  record.name = 'new name'
11
11
  record.save!
12
12
  assert_equal 'new name', record.name
13
13
  end
14
14
 
15
- test "should delete associated translation" do
15
+ test "delete associated translation" do
16
16
  record.destroy
17
17
  assert_nil ModelTranslation.find_by_model_id(record.id)
18
18
  end
19
19
 
20
- test "should change locales" do
20
+ test "change locales" do
21
21
  record.with_locale :es
22
22
  assert_nil record.name
23
23
  record.name = 'new name'
@@ -30,7 +30,7 @@ class RecrodsTest < ActiveSupport::TestCase
30
30
  private
31
31
 
32
32
  def record
33
- @record ||= Model.create(name: 'name')
33
+ @record ||= Model.create(name: 'name')
34
34
  end
35
35
 
36
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translatable_records
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Museways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2014-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -44,7 +44,7 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.3'
47
- description: Everything you need to work with translatable records.
47
+ description: Minimalistic toolkit to work with translatable records in rails.
48
48
  email:
49
49
  - hello@museways.com
50
50
  executables: []