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 +4 -4
- data/README.rdoc +32 -26
- data/lib/generators/templates/migration.rb +1 -1
- data/lib/generators/templates/model.rb +1 -1
- data/lib/generators/translation_generator.rb +5 -5
- data/lib/translatable_records.rb +0 -1
- data/lib/translatable_records/active_record/base.rb +1 -2
- data/lib/translatable_records/active_record/translatable.rb +6 -6
- data/lib/translatable_records/version.rb +1 -1
- data/test/dummy/app/models/model_translation.rb +3 -3
- data/test/dummy/log/test.log +385 -0
- data/test/generators_test.rb +8 -8
- data/test/records_test.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0929838911d0ef7b67521a3dc3e731399c7308d1
|
4
|
+
data.tar.gz: d59d23519e18fae7a7677fac1fb79c8c52aebd91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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]
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
39
|
-
<%=
|
40
|
-
|
41
|
-
|
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
|
@@ -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
|
data/lib/translatable_records.rb
CHANGED
@@ -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
|
data/test/dummy/log/test.log
CHANGED
@@ -3477,3 +3477,388 @@ RecrodsTest: test_should_edit_associated_translation
|
|
3477
3477
|
[1m[35m (0.1ms)[0m 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
|
[1m[36m (0.1ms)[0m [1mUPDATE "model_translations" SET "name" = 'new name', "updated_at" = '2014-06-09 18:26:46.135758' WHERE "model_translations"."id" = 1[0m
|
3479
3479
|
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3480
|
+
[1m[36m (0.3ms)[0m [1mCREATE 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) [0m
|
3481
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3482
|
+
[1m[36m (0.2ms)[0m [1mCREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")[0m
|
3483
|
+
[1m[35m (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")[0m
|
3492
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
|
3493
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
3494
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3495
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
3496
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
|
3497
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3498
|
+
--------------------------------------
|
3499
|
+
I18nGeneratorTest: test_generate_files
|
3500
|
+
--------------------------------------
|
3501
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3502
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3503
|
+
--------------------------------
|
3504
|
+
RecordsTest: test_change_locales
|
3505
|
+
--------------------------------
|
3506
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
3507
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3508
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3511
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1[0m [["model_id", 1]]
|
3512
|
+
[1m[35mModelTranslation Load (0.0ms)[0m SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
|
3513
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3514
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
|
3515
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3517
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3518
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3519
|
+
-----------------------------------------------
|
3520
|
+
RecordsTest: test_create_associated_translation
|
3521
|
+
-----------------------------------------------
|
3522
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3523
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
|
3524
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", "2014-06-25 02:02:06.175525"], ["updated_at", "2014-06-25 02:02:06.175525"]]
|
3525
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
3527
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3528
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3529
|
+
-----------------------------------------------
|
3530
|
+
RecordsTest: test_delete_associated_translation
|
3531
|
+
-----------------------------------------------
|
3532
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3533
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3534
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3537
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3538
|
+
[1m[35mSQL (0.1ms)[0m DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
|
3539
|
+
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "models" WHERE "models"."id" = ?[0m [["id", 1]]
|
3540
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3541
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1[0m
|
3542
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3543
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3544
|
+
---------------------------------------------
|
3545
|
+
RecordsTest: test_edit_associated_translation
|
3546
|
+
---------------------------------------------
|
3547
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3548
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3549
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3552
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3553
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mUPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1[0m [["name", "new name"], ["updated_at", "2014-06-25 02:02:06.185945"]]
|
3555
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3556
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3557
|
+
[1m[36m (0.3ms)[0m [1mCREATE 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) [0m
|
3558
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3559
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")[0m
|
3560
|
+
[1m[35m (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")[0m
|
3569
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
|
3570
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
3571
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3572
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
3573
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
|
3574
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3575
|
+
--------------------------------------
|
3576
|
+
I18nGeneratorTest: test_generate_files
|
3577
|
+
--------------------------------------
|
3578
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3579
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3580
|
+
--------------------------------
|
3581
|
+
RecordsTest: test_change_locales
|
3582
|
+
--------------------------------
|
3583
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
3584
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3585
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3588
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1[0m [["model_id", 1]]
|
3589
|
+
[1m[35mModelTranslation Load (0.0ms)[0m SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
|
3590
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
3591
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
|
3592
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3594
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3595
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3596
|
+
-----------------------------------------------
|
3597
|
+
RecordsTest: test_create_associated_translation
|
3598
|
+
-----------------------------------------------
|
3599
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3600
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
|
3601
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", "2014-06-25 02:02:38.814705"], ["updated_at", "2014-06-25 02:02:38.814705"]]
|
3602
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
3604
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3605
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3606
|
+
-----------------------------------------------
|
3607
|
+
RecordsTest: test_delete_associated_translation
|
3608
|
+
-----------------------------------------------
|
3609
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3610
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3611
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3614
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3615
|
+
[1m[35mSQL (0.1ms)[0m DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
|
3616
|
+
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "models" WHERE "models"."id" = ?[0m [["id", 1]]
|
3617
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3618
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1[0m
|
3619
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3620
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3621
|
+
---------------------------------------------
|
3622
|
+
RecordsTest: test_edit_associated_translation
|
3623
|
+
---------------------------------------------
|
3624
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3625
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3626
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3629
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3630
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mUPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1[0m [["name", "new name"], ["updated_at", "2014-06-25 02:02:38.825459"]]
|
3632
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
3633
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3634
|
+
[1m[36m (0.3ms)[0m [1mCREATE 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) [0m
|
3635
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3636
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")[0m
|
3637
|
+
[1m[35m (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")[0m
|
3646
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
|
3647
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
3648
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3649
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
3650
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
|
3651
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3652
|
+
--------------------------------
|
3653
|
+
RecordsTest: test_change_locales
|
3654
|
+
--------------------------------
|
3655
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
3656
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3657
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3660
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1[0m [["model_id", 1]]
|
3661
|
+
[1m[35mModelTranslation Load (0.1ms)[0m SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
|
3662
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3663
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
|
3664
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3666
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3667
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3668
|
+
-----------------------------------------------
|
3669
|
+
RecordsTest: test_create_associated_translation
|
3670
|
+
-----------------------------------------------
|
3671
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3672
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
|
3673
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", "2014-06-25 02:04:42.413750"], ["updated_at", "2014-06-25 02:04:42.413750"]]
|
3674
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
3676
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3677
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3678
|
+
-----------------------------------------------
|
3679
|
+
RecordsTest: test_delete_associated_translation
|
3680
|
+
-----------------------------------------------
|
3681
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3682
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3683
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3686
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3687
|
+
[1m[35mSQL (0.1ms)[0m DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
|
3688
|
+
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "models" WHERE "models"."id" = ?[0m [["id", 1]]
|
3689
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
3690
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1[0m
|
3691
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3692
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3693
|
+
---------------------------------------------
|
3694
|
+
RecordsTest: test_edit_associated_translation
|
3695
|
+
---------------------------------------------
|
3696
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3697
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3698
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3701
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3702
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mUPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1[0m [["name", "new name"], ["updated_at", "2014-06-25 02:04:42.423855"]]
|
3704
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3705
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3706
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3707
|
+
--------------------------------------
|
3708
|
+
I18nGeneratorTest: test_generate_files
|
3709
|
+
--------------------------------------
|
3710
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3711
|
+
[1m[36m (0.3ms)[0m [1mCREATE 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) [0m
|
3712
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3713
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")[0m
|
3714
|
+
[1m[35m (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")[0m
|
3723
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
|
3724
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
3725
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3726
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
3727
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
|
3728
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3729
|
+
--------------------------------
|
3730
|
+
RecordsTest: test_change_locales
|
3731
|
+
--------------------------------
|
3732
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3733
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3734
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3737
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1[0m [["model_id", 1]]
|
3738
|
+
[1m[35mModelTranslation Load (0.0ms)[0m SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
|
3739
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
3740
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
|
3741
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3743
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3744
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3745
|
+
-----------------------------------------------
|
3746
|
+
RecordsTest: test_create_associated_translation
|
3747
|
+
-----------------------------------------------
|
3748
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3749
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
|
3750
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", "2014-06-25 02:05:09.223631"], ["updated_at", "2014-06-25 02:05:09.223631"]]
|
3751
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
3753
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3754
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3755
|
+
-----------------------------------------------
|
3756
|
+
RecordsTest: test_delete_associated_translation
|
3757
|
+
-----------------------------------------------
|
3758
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3759
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3760
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36mSQL (0.0ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3763
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3764
|
+
[1m[35mSQL (0.1ms)[0m DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
|
3765
|
+
[1m[36mSQL (0.0ms)[0m [1mDELETE FROM "models" WHERE "models"."id" = ?[0m [["id", 1]]
|
3766
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3767
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1[0m
|
3768
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3769
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3770
|
+
---------------------------------------------
|
3771
|
+
RecordsTest: test_edit_associated_translation
|
3772
|
+
---------------------------------------------
|
3773
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3774
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3775
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3778
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3779
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mUPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1[0m [["name", "new name"], ["updated_at", "2014-06-25 02:05:09.233370"]]
|
3781
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3782
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3783
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3784
|
+
--------------------------------------
|
3785
|
+
I18nGeneratorTest: test_generate_files
|
3786
|
+
--------------------------------------
|
3787
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3788
|
+
[1m[36m (0.3ms)[0m [1mCREATE 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) [0m
|
3789
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3790
|
+
[1m[36m (0.2ms)[0m [1mCREATE INDEX "index_model_translations_on_locale" ON "model_translations" ("locale")[0m
|
3791
|
+
[1m[35m (0.1ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_model_translations_on_model_id" ON "model_translations" ("model_id")[0m
|
3800
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime, "updated_at" datetime)
|
3801
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
3802
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3803
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
3804
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20130819165249')
|
3805
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3806
|
+
-----------------------------------
|
3807
|
+
GeneratorsTest: test_generate_files
|
3808
|
+
-----------------------------------
|
3809
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3810
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3811
|
+
--------------------------------
|
3812
|
+
RecordsTest: test_change_locales
|
3813
|
+
--------------------------------
|
3814
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
3815
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3816
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3819
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1[0m [["model_id", 1]]
|
3820
|
+
[1m[35mModelTranslation Load (0.1ms)[0m SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = ? AND "model_translations"."locale" = 'es' LIMIT 1 [["model_id", 1]]
|
3821
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
3822
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" = 1 AND "model_translations"."locale" = 'es') LIMIT 1
|
3823
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3825
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3826
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3827
|
+
-----------------------------------------------
|
3828
|
+
RecordsTest: test_create_associated_translation
|
3829
|
+
-----------------------------------------------
|
3830
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3831
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m SELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1
|
3832
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "models" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", "2014-07-23 13:40:16.695153"], ["updated_at", "2014-07-23 13:40:16.695153"]]
|
3833
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
3835
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3836
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3837
|
+
-----------------------------------------------
|
3838
|
+
RecordsTest: test_delete_associated_translation
|
3839
|
+
-----------------------------------------------
|
3840
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3841
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3842
|
+
[1m[35mSQL (0.0ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3845
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3846
|
+
[1m[35mSQL (0.1ms)[0m DELETE FROM "model_translations" WHERE "model_translations"."id" = ? [["id", 1]]
|
3847
|
+
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "models" WHERE "models"."id" = ?[0m [["id", 1]]
|
3848
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3849
|
+
[1m[36mModelTranslation Load (0.1ms)[0m [1mSELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = 1 LIMIT 1[0m
|
3850
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3851
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3852
|
+
---------------------------------------------
|
3853
|
+
RecordsTest: test_edit_associated_translation
|
3854
|
+
---------------------------------------------
|
3855
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
3856
|
+
[1m[36mModelTranslation Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "model_translations" WHERE ("model_translations"."model_id" IS NULL AND "model_translations"."locale" = 'en') LIMIT 1[0m
|
3857
|
+
[1m[35mSQL (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "model_translations" ("created_at", "locale", "model_id", "name", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["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
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3860
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
3861
|
+
[1m[35mModelTranslation Exists (0.1ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mUPDATE "model_translations" SET "name" = ?, "updated_at" = ? WHERE "model_translations"."id" = 1[0m [["name", "new name"], ["updated_at", "2014-07-23 13:40:16.706625"]]
|
3863
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
3864
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
data/test/generators_test.rb
CHANGED
@@ -2,19 +2,19 @@ require 'test_helper'
|
|
2
2
|
require 'rails/generators'
|
3
3
|
require 'generators/translation_generator'
|
4
4
|
|
5
|
-
class
|
5
|
+
class GeneratorsTest < Rails::Generators::TestCase
|
6
6
|
|
7
|
-
|
8
|
-
FileUtils.rm_rf
|
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 "
|
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
|
3
|
+
class RecordsTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
test "
|
5
|
+
test "create associated translation" do
|
6
6
|
assert_equal 'name', record.name
|
7
7
|
end
|
8
8
|
|
9
|
-
test "
|
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 "
|
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 "
|
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.
|
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-
|
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:
|
47
|
+
description: Minimalistic toolkit to work with translatable records in rails.
|
48
48
|
email:
|
49
49
|
- hello@museways.com
|
50
50
|
executables: []
|