serializer 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -1
- data/lib/serializer/version.rb +1 -1
- data/lib/serializer.rb +4 -1
- data/test/dummy/app/models/user.rb +1 -0
- data/test/dummy/app/views/users/_form.html.erb +10 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +171 -0
- data/test/dummy/log/test.log +423 -0
- data/test/dummy/test/integration/user_create_test.rb +1 -1
- data/test/dummy/test/integration/user_update_test.rb +1 -1
- data/test/dummy/test/unit/user_test.rb +13 -2
- data/test/dummy/tmp/cache/assets/CAA/620/sprockets%2F87b209c0c9da28094a8d5581a21262c6 +0 -0
- data/test/dummy/tmp/cache/assets/CDF/070/sprockets%2F70e3c8a3916622c17858d520dcee0d92 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/CF7/670/sprockets%2F00b214e322c484fcc1555dafaa240947 +9288 -0
- data/test/dummy/tmp/cache/assets/CFB/150/sprockets%2Ff5209763c82e66ecdff0f9583166f557 +378 -0
- data/test/dummy/tmp/cache/assets/D06/B40/sprockets%2F25fca4643219052b0d5c66cf2c71f72f +0 -0
- data/test/dummy/tmp/cache/assets/D11/430/sprockets%2F25ea8d6063b1eb98361b1196f2fce807 +10 -0
- data/test/dummy/tmp/cache/assets/D11/D20/sprockets%2Fcac21eac42152981882bf9e489316af4 +61 -0
- data/test/dummy/tmp/cache/assets/D24/5A0/sprockets%2F3a89b583dd80975d1e0968e730de5bc9 +0 -0
- data/test/dummy/tmp/cache/assets/D2F/290/sprockets%2Fd5c244ec777cb5719f86d085df9f8816 +394 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D46/650/sprockets%2Ff56253b5f374fff1a33fbbc9881c9124 +0 -0
- data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +86 -0
- data/test/dummy/tmp/cache/assets/D6B/5D0/sprockets%2F48da0deeef45ff0cac611596e0774114 +9272 -0
- data/test/dummy/tmp/cache/assets/D73/220/sprockets%2F3dbc0a37f98fb43ec819b85a64d32c55 +10 -0
- data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +9645 -0
- data/test/dummy/tmp/cache/assets/DA7/530/sprockets%2Fe36b8fcf5914a3a6bf058abfe7367b19 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- metadata +43 -13
data/README.rdoc
CHANGED
@@ -4,7 +4,14 @@ Serializer is a Ruby on Rails tool for adding accessor to serialized attributes
|
|
4
4
|
|
5
5
|
== Requirements
|
6
6
|
|
7
|
-
The gem is tested with
|
7
|
+
The gem is tested with:
|
8
|
+
|
9
|
+
* Ruby (MRI) 1.9.3 (p0)
|
10
|
+
* Ruby (MRI) 1.9.2 (p180)
|
11
|
+
* Ruby (MRI) 1.8.7 (p334)
|
12
|
+
* Ruby (REE) 1.8.7 (2011.03)
|
13
|
+
* JRuby 1.6.2
|
14
|
+
* Rubinius 1.2.4
|
8
15
|
|
9
16
|
== Installation
|
10
17
|
|
data/lib/serializer/version.rb
CHANGED
data/lib/serializer.rb
CHANGED
@@ -51,7 +51,10 @@ module Serializer
|
|
51
51
|
when :integer then value = value.to_i if value.respond_to? :to_i
|
52
52
|
when :string then value = value.to_str if value.respond_to? :to_str
|
53
53
|
when :symbol then value = value.to_sym if value.respond_to? :to_sym
|
54
|
-
when :boolean then
|
54
|
+
when :boolean then
|
55
|
+
value = true if value.eql? "true"
|
56
|
+
value = false if value.eql? "false"
|
57
|
+
value = !value.to_i.zero? if value.respond_to? :to_i
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
@@ -3,6 +3,7 @@ class User < ActiveRecord::Base
|
|
3
3
|
has_serialized :settings do |settings|
|
4
4
|
settings.define :tw_share, :default => true, :type => :boolean
|
5
5
|
settings.define :fb_share, :default => true, :type => :boolean
|
6
|
+
settings.define :tumblr_share, :default => true, :type => :boolean
|
6
7
|
end
|
7
8
|
|
8
9
|
end
|
@@ -29,6 +29,16 @@
|
|
29
29
|
<%= f.label :tw_share, "TW Share" %>
|
30
30
|
</div>
|
31
31
|
|
32
|
+
<div class="field">
|
33
|
+
<%= f.radio_button :tumblr_share, true %>
|
34
|
+
<%= f.label :tumblr_share_true, "Enable Tumblr Share" %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="field">
|
38
|
+
<%= f.radio_button :tumblr_share, false %>
|
39
|
+
<%= f.label :tumblr_share_false, "Disable Tumblr Share" %>
|
40
|
+
</div>
|
41
|
+
|
32
42
|
<div class="actions">
|
33
43
|
<%= f.submit %>
|
34
44
|
</div>
|
Binary file
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -22,3 +22,174 @@ Migrating to CreateUsers (20110927222742)
|
|
22
22
|
[1m[35m (2.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
23
23
|
[1m[36m (2.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
24
24
|
[1m[35m (2.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110927222742')
|
25
|
+
|
26
|
+
|
27
|
+
Started GET "/" for 127.0.0.1 at 2011-12-02 17:56:14 -0800
|
28
|
+
Processing by MainController#index as HTML
|
29
|
+
Rendered main/index.html.erb within layouts/application (3.0ms)
|
30
|
+
Compiled application.css (2ms) (pid 20134)
|
31
|
+
Compiled main.css (0ms) (pid 20134)
|
32
|
+
Compiled scaffold.css (0ms) (pid 20134)
|
33
|
+
Compiled users.css (0ms) (pid 20134)
|
34
|
+
Compiled application.js (4ms) (pid 20134)
|
35
|
+
Compiled jquery.js (3ms) (pid 20134)
|
36
|
+
Compiled jquery_ujs.js (0ms) (pid 20134)
|
37
|
+
Compiled main.js (0ms) (pid 20134)
|
38
|
+
Compiled users.js (0ms) (pid 20134)
|
39
|
+
Completed 200 OK in 189ms (Views: 188.2ms | ActiveRecord: 0.0ms)
|
40
|
+
|
41
|
+
|
42
|
+
Started GET "/assets/scaffold.css?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
43
|
+
Served asset /scaffold.css - 200 OK (4ms)
|
44
|
+
|
45
|
+
|
46
|
+
Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
47
|
+
Served asset /users.css - 200 OK (3ms)
|
48
|
+
|
49
|
+
|
50
|
+
Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
51
|
+
Served asset /users.js - 200 OK (2ms)
|
52
|
+
|
53
|
+
|
54
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
55
|
+
Served asset /jquery.js - 200 OK (8ms)
|
56
|
+
|
57
|
+
|
58
|
+
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
59
|
+
Served asset /application.css - 200 OK (0ms)
|
60
|
+
|
61
|
+
|
62
|
+
Started GET "/assets/main.css?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
63
|
+
Served asset /main.css - 200 OK (3ms)
|
64
|
+
|
65
|
+
|
66
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
67
|
+
Served asset /jquery_ujs.js - 200 OK (2ms)
|
68
|
+
|
69
|
+
|
70
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
71
|
+
Served asset /application.js - 200 OK (0ms)
|
72
|
+
|
73
|
+
|
74
|
+
Started GET "/assets/main.js?body=1" for 127.0.0.1 at 2011-12-02 17:56:15 -0800
|
75
|
+
Served asset /main.js - 200 OK (1ms)
|
76
|
+
|
77
|
+
|
78
|
+
Started GET "/users" for 127.0.0.1 at 2011-12-02 17:56:17 -0800
|
79
|
+
Processing by UsersController#index as HTML
|
80
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" [0m
|
81
|
+
Rendered users/index.html.erb within layouts/application (1.0ms)
|
82
|
+
Completed 200 OK in 51ms (Views: 25.8ms | ActiveRecord: 0.9ms)
|
83
|
+
|
84
|
+
|
85
|
+
Started GET "/users/new" for 127.0.0.1 at 2011-12-02 17:56:18 -0800
|
86
|
+
Processing by UsersController#new as HTML
|
87
|
+
Rendered users/_form.html.erb (9.6ms)
|
88
|
+
Rendered users/new.html.erb within layouts/application (13.5ms)
|
89
|
+
Completed 200 OK in 51ms (Views: 19.4ms | ActiveRecord: 0.6ms)
|
90
|
+
|
91
|
+
|
92
|
+
Started POST "/users" for 127.0.0.1 at 2011-12-02 17:56:24 -0800
|
93
|
+
Processing by UsersController#create as HTML
|
94
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"c0PKUGFzfNP0RgKHBlmBR++qRjO5B4ItDyZK8vkXrN0=", "user"=>{"name"=>"Kevin", "email"=>"", "fb_share"=>"1", "tw_share"=>"1", "tumblr_share"=>"true"}, "commit"=>"Create User"}
|
95
|
+
[1m[35mSQL (5.3ms)[0m INSERT INTO "users" ("created_at", "email", "name", "settings", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", Sat, 03 Dec 2011 01:56:24 UTC +00:00], ["email", ""], ["name", "Kevin"], ["settings", "---\n:fb_share: true\n:tw_share: true\n:tumblr_share: true\n"], ["updated_at", Sat, 03 Dec 2011 01:56:24 UTC +00:00]]
|
96
|
+
Redirected to http://localhost:3000/users/1
|
97
|
+
Completed 302 Found in 49ms
|
98
|
+
|
99
|
+
|
100
|
+
Started GET "/users/1" for 127.0.0.1 at 2011-12-02 17:56:24 -0800
|
101
|
+
Processing by UsersController#show as HTML
|
102
|
+
Parameters: {"id"=>"1"}
|
103
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", "1"]]
|
104
|
+
Rendered users/show.html.erb within layouts/application (6.7ms)
|
105
|
+
Completed 200 OK in 22ms (Views: 13.7ms | ActiveRecord: 0.8ms)
|
106
|
+
|
107
|
+
|
108
|
+
Started GET "/users/1/edit" for 127.0.0.1 at 2011-12-02 17:56:26 -0800
|
109
|
+
Processing by UsersController#edit as HTML
|
110
|
+
Parameters: {"id"=>"1"}
|
111
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
|
112
|
+
Rendered users/_form.html.erb (8.1ms)
|
113
|
+
Rendered users/edit.html.erb within layouts/application (9.9ms)
|
114
|
+
Completed 200 OK in 21ms (Views: 15.8ms | ActiveRecord: 0.7ms)
|
115
|
+
|
116
|
+
|
117
|
+
Started PUT "/users/1" for 127.0.0.1 at 2011-12-02 17:56:27 -0800
|
118
|
+
Processing by UsersController#update as HTML
|
119
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"c0PKUGFzfNP0RgKHBlmBR++qRjO5B4ItDyZK8vkXrN0=", "user"=>{"name"=>"Kevin", "email"=>"", "fb_share"=>"1", "tw_share"=>"1", "tumblr_share"=>"false"}, "commit"=>"Update User", "id"=>"1"}
|
120
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", "1"]]
|
121
|
+
[1m[35m (0.3ms)[0m UPDATE "users" SET "updated_at" = '2011-12-03 01:56:27.873633', "settings" = '---
|
122
|
+
:fb_share: true
|
123
|
+
:tw_share: true
|
124
|
+
:tumblr_share: false
|
125
|
+
' WHERE "users"."id" = 1
|
126
|
+
Redirected to http://localhost:3000/users/1
|
127
|
+
Completed 302 Found in 19ms
|
128
|
+
|
129
|
+
|
130
|
+
Started GET "/users/1" for 127.0.0.1 at 2011-12-02 17:56:27 -0800
|
131
|
+
Processing by UsersController#show as HTML
|
132
|
+
Parameters: {"id"=>"1"}
|
133
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", "1"]]
|
134
|
+
Rendered users/show.html.erb within layouts/application (5.6ms)
|
135
|
+
Completed 200 OK in 19ms (Views: 12.2ms | ActiveRecord: 0.8ms)
|
136
|
+
|
137
|
+
|
138
|
+
Started GET "/users/1/edit" for 127.0.0.1 at 2011-12-02 17:56:29 -0800
|
139
|
+
Processing by UsersController#edit as HTML
|
140
|
+
Parameters: {"id"=>"1"}
|
141
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
|
142
|
+
Rendered users/_form.html.erb (7.8ms)
|
143
|
+
Rendered users/edit.html.erb within layouts/application (9.3ms)
|
144
|
+
Completed 200 OK in 21ms (Views: 15.5ms | ActiveRecord: 0.6ms)
|
145
|
+
|
146
|
+
|
147
|
+
Started PUT "/users/1" for 127.0.0.1 at 2011-12-02 17:56:30 -0800
|
148
|
+
Processing by UsersController#update as HTML
|
149
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"c0PKUGFzfNP0RgKHBlmBR++qRjO5B4ItDyZK8vkXrN0=", "user"=>{"name"=>"Kevin", "email"=>"", "fb_share"=>"1", "tw_share"=>"1", "tumblr_share"=>"true"}, "commit"=>"Update User", "id"=>"1"}
|
150
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", "1"]]
|
151
|
+
[1m[35m (0.3ms)[0m UPDATE "users" SET "updated_at" = '2011-12-03 01:56:30.814349', "settings" = '---
|
152
|
+
:fb_share: true
|
153
|
+
:tw_share: true
|
154
|
+
:tumblr_share: true
|
155
|
+
' WHERE "users"."id" = 1
|
156
|
+
Redirected to http://localhost:3000/users/1
|
157
|
+
Completed 302 Found in 23ms
|
158
|
+
|
159
|
+
|
160
|
+
Started GET "/users/1" for 127.0.0.1 at 2011-12-02 17:56:30 -0800
|
161
|
+
Processing by UsersController#show as HTML
|
162
|
+
Parameters: {"id"=>"1"}
|
163
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", "1"]]
|
164
|
+
Rendered users/show.html.erb within layouts/application (5.9ms)
|
165
|
+
Completed 200 OK in 18ms (Views: 11.9ms | ActiveRecord: 0.6ms)
|
166
|
+
|
167
|
+
|
168
|
+
Started GET "/users/1/edit" for 127.0.0.1 at 2011-12-02 17:56:32 -0800
|
169
|
+
Processing by UsersController#edit as HTML
|
170
|
+
Parameters: {"id"=>"1"}
|
171
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
|
172
|
+
Rendered users/_form.html.erb (8.6ms)
|
173
|
+
Rendered users/edit.html.erb within layouts/application (10.1ms)
|
174
|
+
Completed 200 OK in 22ms (Views: 16.3ms | ActiveRecord: 0.6ms)
|
175
|
+
|
176
|
+
|
177
|
+
Started PUT "/users/1" for 127.0.0.1 at 2011-12-02 17:56:33 -0800
|
178
|
+
Processing by UsersController#update as HTML
|
179
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"c0PKUGFzfNP0RgKHBlmBR++qRjO5B4ItDyZK8vkXrN0=", "user"=>{"name"=>"Kevin", "email"=>"", "fb_share"=>"1", "tw_share"=>"1", "tumblr_share"=>"false"}, "commit"=>"Update User", "id"=>"1"}
|
180
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", "1"]]
|
181
|
+
[1m[35m (0.4ms)[0m UPDATE "users" SET "updated_at" = '2011-12-03 01:56:33.962584', "settings" = '---
|
182
|
+
:fb_share: true
|
183
|
+
:tw_share: true
|
184
|
+
:tumblr_share: false
|
185
|
+
' WHERE "users"."id" = 1
|
186
|
+
Redirected to http://localhost:3000/users/1
|
187
|
+
Completed 302 Found in 19ms
|
188
|
+
|
189
|
+
|
190
|
+
Started GET "/users/1" for 127.0.0.1 at 2011-12-02 17:56:34 -0800
|
191
|
+
Processing by UsersController#show as HTML
|
192
|
+
Parameters: {"id"=>"1"}
|
193
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", "1"]]
|
194
|
+
Rendered users/show.html.erb within layouts/application (6.3ms)
|
195
|
+
Completed 200 OK in 18ms (Views: 12.0ms | ActiveRecord: 0.7ms)
|