active_record_date_formatted 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/lib/active_record_date_formatted/version.rb +1 -1
- data/test/dummy/log/test.log +43 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f1714731a486b45eb5bda36c470a942744d91d1
|
4
|
+
data.tar.gz: b9e927ceb04f81c374fe0b6c73fe0bcac8a5ed93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e63838b7f4597367c8fa069634c424f996eefe4dcd402b295a2768dd4f311a2a8c1a42dc4103ff598df14a10a6522fadd663875284a75cce94a923312e75505
|
7
|
+
data.tar.gz: e04301a6165c9b3bc2ad42935aafc1c8af94b7cf0e47714d7866a2c17b2a5f1109221b3f64a516a31d3fb129a21f3091d46a4bffcee9d098447165862eb0c9d3
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# ActiveRecordDateFormatted
|
2
2
|
|
3
|
-
|
3
|
+
## Installation
|
4
4
|
|
5
|
-
Add to your Gemfile: gem 'active_record_date_formatted'
|
5
|
+
Add to your Gemfile: **gem 'active_record_date_formatted'**
|
6
6
|
|
7
7
|
And that's it.
|
8
8
|
|
@@ -10,10 +10,11 @@ Now for every active record model's date attribute, you have two additional meth
|
|
10
10
|
- birthdate_formatted
|
11
11
|
- birthdate_formatted=(formatted_date)
|
12
12
|
|
13
|
-
The formatted methods use
|
13
|
+
The formatted methods use **date.formats.default** format.
|
14
14
|
|
15
15
|
For example for german locale:
|
16
16
|
|
17
|
+
<pre>
|
17
18
|
de:
|
18
19
|
date:
|
19
20
|
formats:
|
@@ -25,9 +26,10 @@ Person.first.birthdate_formatted = "24.04.1981"
|
|
25
26
|
I18n.locale = :en
|
26
27
|
Person.first.birthdate_formatted # => "1981-04-12"
|
27
28
|
Person.first.birthdate_formatted = "1981-04-24"
|
29
|
+
</pre>
|
28
30
|
|
29
31
|
Now you can use the *_formatted in your views, for example when using date pickers.
|
30
32
|
|
31
|
-
|
33
|
+
## Licence
|
32
34
|
|
33
35
|
This project uses MIT-LICENSE.
|
data/test/dummy/log/test.log
CHANGED
@@ -927,3 +927,46 @@ ActiveRecordDateFormattedTest: test_date_formatted_getter_german
|
|
927
927
|
[1m[36mPerson Load (0.1ms)[0m [1mSELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1[0m
|
928
928
|
[1m[35mPerson Load (0.1ms)[0m SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
|
929
929
|
[1m[36m (1.4ms)[0m [1mrollback transaction[0m
|
930
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
931
|
+
[1m[35m (0.1ms)[0m begin transaction
|
932
|
+
---------------------------------------------------------
|
933
|
+
ActiveRecordDateFormattedTest: test_date_formatted_getter
|
934
|
+
---------------------------------------------------------
|
935
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
936
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "people" ("birth_date", "created_at", "updated_at") VALUES (?, ?, ?) [["birth_date", "1971-02-18"], ["created_at", "2015-09-11 15:56:41.132420"], ["updated_at", "2015-09-11 15:56:41.132420"]]
|
937
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
938
|
+
[1m[35mPerson Load (0.1ms)[0m SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
|
939
|
+
[1m[36mPerson Load (0.1ms)[0m [1mSELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1[0m
|
940
|
+
[1m[35m (1.4ms)[0m rollback transaction
|
941
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
942
|
+
--------------------------------------------------
|
943
|
+
ActiveRecordDateFormattedTest: test_module_defined
|
944
|
+
--------------------------------------------------
|
945
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
946
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "people" ("birth_date", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["birth_date", "1971-02-18"], ["created_at", "2015-09-11 15:56:41.142590"], ["updated_at", "2015-09-11 15:56:41.142590"]]
|
947
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
948
|
+
[1m[36m (1.3ms)[0m [1mrollback transaction[0m
|
949
|
+
[1m[35m (0.1ms)[0m begin transaction
|
950
|
+
----------------------------------------------------------------
|
951
|
+
ActiveRecordDateFormattedTest: test_date_formatted_getter_german
|
952
|
+
----------------------------------------------------------------
|
953
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
954
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "people" ("birth_date", "created_at", "updated_at") VALUES (?, ?, ?) [["birth_date", "1971-02-18"], ["created_at", "2015-09-11 15:56:41.146012"], ["updated_at", "2015-09-11 15:56:41.146012"]]
|
955
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
956
|
+
[1m[35mPerson Load (0.1ms)[0m SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
|
957
|
+
[1m[36mPerson Load (0.1ms)[0m [1mSELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1[0m
|
958
|
+
[1m[35m (1.5ms)[0m rollback transaction
|
959
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
960
|
+
----------------------------------------------------------------
|
961
|
+
ActiveRecordDateFormattedTest: test_date_formatted_setter_german
|
962
|
+
----------------------------------------------------------------
|
963
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
964
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "people" ("birth_date", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["birth_date", "1971-02-18"], ["created_at", "2015-09-11 15:56:41.151047"], ["updated_at", "2015-09-11 15:56:41.151047"]]
|
965
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
966
|
+
[1m[36mPerson Load (0.1ms)[0m [1mSELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1[0m
|
967
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
968
|
+
[1m[36mSQL (0.4ms)[0m [1mUPDATE "people" SET "birth_date" = ?, "updated_at" = ? WHERE "people"."id" = ?[0m [["birth_date", "1971-02-24"], ["updated_at", "2015-09-11 15:56:41.153683"], ["id", 1]]
|
969
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
970
|
+
[1m[36mPerson Load (0.3ms)[0m [1mSELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1[0m
|
971
|
+
[1m[35mPerson Load (0.1ms)[0m SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
|
972
|
+
[1m[36m (1.5ms)[0m [1mrollback transaction[0m
|