nostalgic 0.4.1 → 0.5.0

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
- SHA1:
3
- metadata.gz: 30046f16c7635d42dc567d99a4f5e56a981f4c95
4
- data.tar.gz: 329f5f5079d7973fba0bd0333fc00209d00c65bd
2
+ SHA256:
3
+ metadata.gz: 00d398b20013b379fec77c694e64fe4e39aadba34bd547a1a6b1b593178dca7a
4
+ data.tar.gz: aa181a9c2e257b7f06db912cb1216993138301f266c7500254488c869f540bbb
5
5
  SHA512:
6
- metadata.gz: 7cf8490c51e7401914a58bad1d5861f20945144854396c525c761c295ef3789affdf66459f11e816c7b963627fd3710cd3a0303462594ad0f47220708814fc0a
7
- data.tar.gz: 6f9f9b6d49c518aa57f06819728d831dd1896572660c38e70d48bc41d7df054192d2000b93443b8996432ea046d0b06d35793b12c359d1d09ee4a5afc9162e17
6
+ metadata.gz: edb885d6afa764ccf104cc9a2f49fa20a76c265a169026ce445dfbb476b31881271ff8fd0ad5ce7d707ea350df2af0d7d1c73cc764210fe3fc47e6a389646e5a
7
+ data.tar.gz: 44f7f5ac5f1313a3c8ee8579215e1b6e618d2a68a3bddcc1a9aa4484a8272dd6321c151e4c2f7fe564ea1ce695f2194125731cff46b447301c15834e5652c11a
@@ -1,5 +1,5 @@
1
1
  module Nostalgic
2
- module NostalgicFor
2
+ module NostalgicAttr
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
@@ -44,7 +44,7 @@ module Nostalgic
44
44
 
45
45
  if scope.fetch(:nostalgic, false)
46
46
  foreign_key = options.fetch(:foreign_key, "#{name}_id")
47
- nostalgic_for foreign_key
47
+ nostalgic_attr foreign_key
48
48
 
49
49
  class_eval <<-METHODS, __FILE__, __LINE__ + 1
50
50
  def #{name}_on(date)
@@ -58,7 +58,7 @@ module Nostalgic
58
58
  end
59
59
  end
60
60
 
61
- def nostalgic_for(*attrs)
61
+ def nostalgic_attr(*attrs)
62
62
  self.nostalgic_attrs ||= []
63
63
 
64
64
  attrs.each do |attr|
@@ -3,8 +3,8 @@ module Nostalgic
3
3
 
4
4
  initializer 'active_record_extension' do
5
5
  ActiveSupport.on_load :active_record do
6
- require_relative 'nostalgic_for'
7
- include Nostalgic::NostalgicFor
6
+ require_relative 'nostalgic_attr'
7
+ include Nostalgic::NostalgicAttr
8
8
  end
9
9
  end
10
10
 
@@ -1,3 +1,3 @@
1
1
  module Nostalgic
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -1,4 +1,4 @@
1
1
  class User < ActiveRecord::Base
2
2
  belongs_to :company, :nostalgic => true
3
- nostalgic_for :tel
3
+ nostalgic_attr :tel
4
4
  end
Binary file
@@ -0,0 +1,162 @@
1
+  (0.1ms) DROP TABLE IF EXISTS "companies"
2
+  (0.1ms) SELECT sqlite_version(*)
3
+  (3.2ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
4
+  (0.1ms) DROP TABLE IF EXISTS "nostalgic_attrs"
5
+  (1.7ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime)
6
+  (0.1ms) DROP TABLE IF EXISTS "users"
7
+  (1.6ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer)
8
+  (1.6ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
9
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
10
+  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20161217105921)
11
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES
12
+ (20160807103323),
13
+ (20161217105723);
14
+
15
+ 
16
+  (1.6ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
17
+ ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
18
+  (0.0ms) begin transaction
19
+ SQL (0.2ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2018-03-08 14:00:42.517009"], ["updated_at", "2018-03-08 14:00:42.517009"]]
20
+  (1.5ms) commit transaction
21
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
22
+  (0.0ms) begin transaction
23
+  (0.0ms) commit transaction
24
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
25
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
26
+ Migrating to CreateNostalgicAttrs (20160807101438)
27
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
28
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
29
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
30
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
31
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
32
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
33
+  (0.1ms) DROP TABLE IF EXISTS "companies"
34
+  (0.1ms) SELECT sqlite_version(*)
35
+  (2.3ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
36
+  (0.2ms) DROP TABLE IF EXISTS "nostalgic_attrs"
37
+  (1.6ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime)
38
+  (0.1ms) DROP TABLE IF EXISTS "users"
39
+  (1.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer)
40
+  (1.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
41
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
42
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES (20161217105921)
43
+  (2.6ms) INSERT INTO "schema_migrations" (version) VALUES
44
+ (20160807103323),
45
+ (20161217105723),
46
+ (20160807101438),
47
+ (20160816080815),
48
+ (20160816080822);
49
+
50
+ 
51
+  (3.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
52
+ ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
53
+  (0.0ms) begin transaction
54
+ SQL (0.2ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "test"], ["created_at", "2018-03-08 14:01:00.180684"], ["updated_at", "2018-03-08 14:01:00.180684"]]
55
+  (1.4ms) commit transaction
56
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
57
+  (0.0ms) begin transaction
58
+  (0.0ms) commit transaction
59
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
60
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
61
+  (0.1ms) PRAGMA foreign_keys
62
+  (0.0ms) PRAGMA foreign_keys = OFF
63
+  (0.1ms) begin transaction
64
+ Fixture Delete (0.2ms) DELETE FROM "companies"
65
+ Fixture Insert (0.1ms) INSERT INTO "companies" ("id", "name", "created_at", "updated_at") VALUES (1, 'TestCompany001', '2018-03-08 14:01:05.322094', '2018-03-08 14:01:05.322094')
66
+ Fixture Insert (0.1ms) INSERT INTO "companies" ("id", "name", "created_at", "updated_at") VALUES (2, 'TestCompany002', '2018-03-08 14:01:05.322094', '2018-03-08 14:01:05.322094')
67
+ Fixture Delete (0.1ms) DELETE FROM "nostalgic_attrs"
68
+ Fixture Insert (0.1ms) INSERT INTO "nostalgic_attrs" ("id", "model_type", "model_id", "name", "value", "effective_at", "created_at", "updated_at") VALUES (1, 'User', 1, 'tel', '111-123-4567', '2018-02-08', '2018-03-08 14:01:05.324387', '2018-03-08 14:01:05.324387')
69
+ Fixture Insert (0.1ms) INSERT INTO "nostalgic_attrs" ("id", "model_type", "model_id", "name", "value", "effective_at", "created_at", "updated_at") VALUES (2, 'User', 1, 'tel', '222-123-4567', '2018-03-08', '2018-03-08 14:01:05.324387', '2018-03-08 14:01:05.324387')
70
+ Fixture Insert (0.1ms) INSERT INTO "nostalgic_attrs" ("id", "model_type", "model_id", "name", "value", "effective_at", "created_at", "updated_at") VALUES (3, 'User', 1, 'tel', '333-123-4567', '2018-03-09', '2018-03-08 14:01:05.324387', '2018-03-08 14:01:05.324387')
71
+ Fixture Insert (0.1ms) INSERT INTO "nostalgic_attrs" ("id", "model_type", "model_id", "name", "value", "effective_at", "created_at", "updated_at") VALUES (4, 'User', 1, 'company_id', '1', '2018-03-07', '2018-03-08 14:01:05.324387', '2018-03-08 14:01:05.324387')
72
+ Fixture Delete (0.1ms) DELETE FROM "users"
73
+ Fixture Insert (0.1ms) INSERT INTO "users" ("id", "company_id", "email", "tel", "created_at", "updated_at") VALUES (1, 1, 'test1@example.com', '222-123-4567', '2018-03-08 14:01:05.331515', '2018-03-08 14:01:05.331515')
74
+  (1.9ms) commit transaction
75
+  (0.1ms) PRAGMA foreign_keys = 1
76
+  (0.1ms) begin transaction
77
+ -------------------------
78
+ UserTest: test_belongs_to
79
+ -------------------------
80
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT ? [["LIMIT", 1]]
81
+ Nostalgic::Attr Load (0.2ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "company_id"], ["LIMIT", 1]]
82
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "tel"], ["LIMIT", 1]]
83
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["LIMIT", 1]]
84
+ Company Load (0.1ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
85
+ Company Load (0.1ms) SELECT "companies".* FROM "companies" ORDER BY "companies"."id" ASC LIMIT ? OFFSET ? [["LIMIT", 1], ["OFFSET", 1]]
86
+  (0.0ms) SAVEPOINT active_record_1
87
+ SQL (0.2ms) UPDATE "users" SET "company_id" = ?, "updated_at" = ? WHERE "users"."id" = ? [["company_id", 2], ["updated_at", "2018-03-08 14:01:05.358714"], ["id", 1]]
88
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND "nostalgic_attrs"."effective_at" = ? ORDER BY "nostalgic_attrs"."id" ASC LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["effective_at", "2018-03-09"], ["LIMIT", 1]]
89
+ SQL (0.1ms) INSERT INTO "nostalgic_attrs" ("model_type", "model_id", "name", "value", "effective_at", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["value", "2"], ["effective_at", "2018-03-09"], ["created_at", "2018-03-08 14:01:05.360580"], ["updated_at", "2018-03-08 14:01:05.360580"]]
90
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND "nostalgic_attrs"."effective_at" = ? ORDER BY "nostalgic_attrs"."id" ASC LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["effective_at", "2018-03-08"], ["LIMIT", 1]]
91
+  (0.1ms) RELEASE SAVEPOINT active_record_1
92
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
93
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "company_id"], ["LIMIT", 1]]
94
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "tel"], ["LIMIT", 1]]
95
+ Company Load (0.1ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
96
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-07') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["LIMIT", 1]]
97
+ Company Load (0.1ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
98
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["LIMIT", 1]]
99
+ Company Load (0.1ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
100
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-09') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["LIMIT", 1]]
101
+ Company Load (0.1ms) SELECT "companies".* FROM "companies" WHERE "companies"."id" = ? LIMIT ? [["id", 2], ["LIMIT", 1]]
102
+  (0.1ms) rollback transaction
103
+  (0.0ms) begin transaction
104
+ ------------------
105
+ UserTest: test_tel
106
+ ------------------
107
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT ? [["LIMIT", 1]]
108
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "company_id"], ["LIMIT", 1]]
109
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "tel"], ["LIMIT", 1]]
110
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-07') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
111
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
112
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-09') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
113
+  (0.1ms) rollback transaction
114
+  (0.0ms) begin transaction
115
+ -----------------------
116
+ UserTest: test_save_tel
117
+ -----------------------
118
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT ? [["LIMIT", 1]]
119
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "company_id"], ["LIMIT", 1]]
120
+ Nostalgic::Attr Load (0.3ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "tel"], ["LIMIT", 1]]
121
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
122
+  (0.0ms) SAVEPOINT active_record_1
123
+ SQL (0.2ms) UPDATE "users" SET "tel" = ?, "updated_at" = ? WHERE "users"."id" = ? [["tel", "444-123-4567"], ["updated_at", "2018-03-08 14:01:05.381445"], ["id", 1]]
124
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND "nostalgic_attrs"."effective_at" = ? ORDER BY "nostalgic_attrs"."id" ASC LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["effective_at", "2018-03-07"], ["LIMIT", 1]]
125
+ Nostalgic::Attr Load (0.0ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND "nostalgic_attrs"."effective_at" = ? ORDER BY "nostalgic_attrs"."id" ASC LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["effective_at", "2018-03-08"], ["LIMIT", 1]]
126
+ SQL (0.1ms) UPDATE "nostalgic_attrs" SET "value" = ?, "updated_at" = ? WHERE "nostalgic_attrs"."id" = ? [["value", "444-123-4567"], ["updated_at", "2018-03-08 14:01:05.383836"], ["id", 2]]
127
+  (0.1ms) RELEASE SAVEPOINT active_record_1
128
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
129
+  (0.0ms) SAVEPOINT active_record_1
130
+ SQL (0.4ms) UPDATE "users" SET "tel" = ?, "updated_at" = ? WHERE "users"."id" = ? [["tel", "555-123-4567"], ["updated_at", "2018-03-08 14:01:05.385645"], ["id", 1]]
131
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND "nostalgic_attrs"."effective_at" = ? ORDER BY "nostalgic_attrs"."id" ASC LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "company_id"], ["effective_at", "2018-03-07"], ["LIMIT", 1]]
132
+ Nostalgic::Attr Load (0.0ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND "nostalgic_attrs"."effective_at" = ? ORDER BY "nostalgic_attrs"."id" ASC LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["effective_at", "2018-03-10"], ["LIMIT", 1]]
133
+ SQL (0.1ms) INSERT INTO "nostalgic_attrs" ("model_type", "model_id", "name", "value", "effective_at", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["value", "555-123-4567"], ["effective_at", "2018-03-10"], ["created_at", "2018-03-08 14:01:05.388194"], ["updated_at", "2018-03-08 14:01:05.388194"]]
134
+  (0.0ms) RELEASE SAVEPOINT active_record_1
135
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
136
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-09') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
137
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-10') ORDER BY effective_at desc LIMIT ? [["model_type", "User"], ["model_id", 1], ["name", "tel"], ["LIMIT", 1]]
138
+  (0.1ms) rollback transaction
139
+  (0.0ms) begin transaction
140
+ -------------------
141
+ UserTest: test_tels
142
+ -------------------
143
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT ? [["LIMIT", 1]]
144
+ Nostalgic::Attr Load (0.1ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "company_id"], ["LIMIT", 1]]
145
+ Nostalgic::Attr Load (0.2ms) SELECT "nostalgic_attrs".* FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? AND (effective_at <= '2018-03-08') ORDER BY effective_at desc LIMIT ? [["model_id", 1], ["model_type", "User"], ["name", "tel"], ["LIMIT", 1]]
146
+  (0.1ms) SELECT COUNT(*) FROM "nostalgic_attrs" WHERE "nostalgic_attrs"."model_id" = ? AND "nostalgic_attrs"."model_type" = ? AND "nostalgic_attrs"."name" = ? [["model_id", 1], ["model_type", "User"], ["name", "tel"]]
147
+  (0.0ms) rollback transaction
148
+  (0.0ms) begin transaction
149
+ --------------------------------------------
150
+ NostalgicTest: test_it_does_something_useful
151
+ --------------------------------------------
152
+  (0.0ms) rollback transaction
153
+  (0.0ms) begin transaction
154
+ ------------------------------------------------
155
+ NostalgicTest: test_that_it_has_a_version_number
156
+ ------------------------------------------------
157
+  (0.0ms) rollback transaction
158
+  (0.0ms) begin transaction
159
+ -----------------------------------------
160
+ Nostalgic::AttrTest: test_nostalgic_model
161
+ -----------------------------------------
162
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nostalgic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-12 00:00:00.000000000 Z
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -115,7 +115,7 @@ files:
115
115
  - lib/nostalgic.rb
116
116
  - lib/nostalgic/engine.rb
117
117
  - lib/nostalgic/form_builder.rb
118
- - lib/nostalgic/nostalgic_for.rb
118
+ - lib/nostalgic/nostalgic_attr.rb
119
119
  - lib/nostalgic/railtie.rb
120
120
  - lib/nostalgic/version.rb
121
121
  - lib/tasks/nostalgic_tasks.rake
@@ -155,6 +155,8 @@ files:
155
155
  - test/dummy/db/migrate/20161217105723_create_companies.rb
156
156
  - test/dummy/db/migrate/20161217105921_add_column_company_id_on_users.rb
157
157
  - test/dummy/db/schema.rb
158
+ - test/dummy/db/test.sqlite3
159
+ - test/dummy/log/test.log
158
160
  - test/dummy/public/404.html
159
161
  - test/dummy/public/422.html
160
162
  - test/dummy/public/500.html
@@ -189,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
191
  version: '0'
190
192
  requirements: []
191
193
  rubyforge_project:
192
- rubygems_version: 2.6.13
194
+ rubygems_version: 2.7.6
193
195
  signing_key:
194
196
  specification_version: 4
195
197
  summary: column versioning utility
@@ -230,12 +232,14 @@ test_files:
230
232
  - test/dummy/db/migrate/20161217105723_create_companies.rb
231
233
  - test/dummy/db/migrate/20161217105921_add_column_company_id_on_users.rb
232
234
  - test/dummy/db/schema.rb
235
+ - test/dummy/db/test.sqlite3
233
236
  - test/dummy/public/404.html
234
237
  - test/dummy/public/422.html
235
238
  - test/dummy/public/500.html
236
239
  - test/dummy/public/favicon.ico
237
240
  - test/dummy/test/models/company_test.rb
238
241
  - test/dummy/test/models/user_test.rb
242
+ - test/dummy/log/test.log
239
243
  - test/fixtures/companies.yml
240
244
  - test/fixtures/nostalgic/attrs.yml
241
245
  - test/fixtures/users.yml