acts_as_customized_attributes 0.0.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.
Files changed (57) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +73 -0
  4. data/Rakefile +26 -0
  5. data/app/models/acts_as_customized_attributes/data.rb +3 -0
  6. data/app/models/acts_as_customized_attributes/data_key.rb +3 -0
  7. data/config/routes.rb +2 -0
  8. data/lib/acts_as_customized_attributes/class_methods.rb +76 -0
  9. data/lib/acts_as_customized_attributes/compatibility.rb +5 -0
  10. data/lib/acts_as_customized_attributes/engine.rb +4 -0
  11. data/lib/acts_as_customized_attributes/instance_methods.rb +20 -0
  12. data/lib/acts_as_customized_attributes/version.rb +3 -0
  13. data/lib/acts_as_customized_attributes.rb +13 -0
  14. data/lib/tasks/acts_as_customized_attributes_tasks.rake +4 -0
  15. data/spec/dummy/Rakefile +7 -0
  16. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  17. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  18. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  19. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  20. data/spec/dummy/app/models/order.rb +5 -0
  21. data/spec/dummy/app/models/user.rb +3 -0
  22. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  23. data/spec/dummy/config/application.rb +45 -0
  24. data/spec/dummy/config/boot.rb +10 -0
  25. data/spec/dummy/config/database.example.yml +42 -0
  26. data/spec/dummy/config/database.shippable.yml +6 -0
  27. data/spec/dummy/config/database.yml +19 -0
  28. data/spec/dummy/config/environment.rb +5 -0
  29. data/spec/dummy/config/environments/development.rb +30 -0
  30. data/spec/dummy/config/environments/production.rb +60 -0
  31. data/spec/dummy/config/environments/test.rb +39 -0
  32. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/spec/dummy/config/initializers/inflections.rb +10 -0
  34. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  35. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  36. data/spec/dummy/config/initializers/session_store.rb +8 -0
  37. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  38. data/spec/dummy/config/locales/en.yml +5 -0
  39. data/spec/dummy/config/routes.rb +58 -0
  40. data/spec/dummy/config.ru +4 -0
  41. data/spec/dummy/db/migrate/20141118114902_create_users.rb +9 -0
  42. data/spec/dummy/db/migrate/20141118114941_create_user_customized_attributes.rb +9 -0
  43. data/spec/dummy/db/migrate/20141118134833_create_orders.rb +9 -0
  44. data/spec/dummy/db/migrate/20141118135027_create_order_customized_attributes.rb +9 -0
  45. data/spec/dummy/db/schema.rb +68 -0
  46. data/spec/dummy/log/development.log +92 -0
  47. data/spec/dummy/log/test.log +1067 -0
  48. data/spec/dummy/public/404.html +26 -0
  49. data/spec/dummy/public/422.html +26 -0
  50. data/spec/dummy/public/500.html +26 -0
  51. data/spec/dummy/public/favicon.ico +0 -0
  52. data/spec/dummy/script/rails +6 -0
  53. data/spec/factories/order.rb +5 -0
  54. data/spec/factories/user.rb +5 -0
  55. data/spec/models/user_spec.rb +25 -0
  56. data/spec/spec_helper.rb +41 -0
  57. metadata +225 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :order do
3
+ association :user, factory: :user
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :user do
3
+ email { Forgery::Internet.email_address }
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ describe User do
4
+ let!(:user){ create :user }
5
+ let!(:order){ create :order, user: user }
6
+
7
+ before do
8
+ user.update_customized_data(facebook_email: "kaspernj@facebook.com")
9
+ end
10
+
11
+ it "should be possible to set custom data and it shouldn't mix up" do
12
+ user.update_customized_data(facebook_email: "kaspernj@facebook.com")
13
+
14
+ order.update_customized_data(affiliate_data: "test")
15
+ order.customized_data[:affiliate_data].should eq "test"
16
+ order.customized_data[:facebook_email].should eq nil
17
+ end
18
+
19
+ it "should autodelete when destroyed" do
20
+ user_id = user.id
21
+ user.destroy
22
+
23
+ UserData.joins(:data_key).where(resource_id: user_id, user_data_keys: {name: "facebook_email"}).first.should eq nil
24
+ end
25
+ end
@@ -0,0 +1,41 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
4
+ ENV["RAILS_ENV"] ||= 'test'
5
+ require File.expand_path("../dummy/config/environment", __FILE__)
6
+ require 'rspec/rails'
7
+ require 'rspec/autorun'
8
+ require 'factory_girl_rails'
9
+ require 'forgery'
10
+
11
+ # Requires supporting ruby files with custom matchers and macros, etc,
12
+ # in spec/support/ and its subdirectories.
13
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
14
+
15
+ RSpec.configure do |config|
16
+ # ## Mock Framework
17
+ #
18
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
19
+ #
20
+ # config.mock_with :mocha
21
+ # config.mock_with :flexmock
22
+ # config.mock_with :rr
23
+
24
+ config.include FactoryGirl::Syntax::Methods
25
+
26
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
27
+ # examples within a transaction, remove the following line or assign false
28
+ # instead of true.
29
+ config.use_transactional_fixtures = true
30
+
31
+ # If true, the base class of anonymous controllers will be inferred
32
+ # automatically. This will be the default behavior in future versions of
33
+ # rspec-rails.
34
+ config.infer_base_class_for_anonymous_controllers = false
35
+
36
+ # Run specs in random order to surface order dependencies. If you find an
37
+ # order dependency and want to debug it, you can fix the order by providing
38
+ # the seed, which is printed after each run.
39
+ # --seed 1234
40
+ config.order = "random"
41
+ end
metadata ADDED
@@ -0,0 +1,225 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_customized_attributes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Kasper Johansen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.12
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.1.12
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: factory_girl_rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: forgery
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codeclimate-test-reporter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mysql2
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Key-based custom attributes that can be created on the fly for ActiveRecord
98
+ models.
99
+ email:
100
+ - k@spernj.org
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - MIT-LICENSE
106
+ - README.md
107
+ - Rakefile
108
+ - app/models/acts_as_customized_attributes/data.rb
109
+ - app/models/acts_as_customized_attributes/data_key.rb
110
+ - config/routes.rb
111
+ - lib/acts_as_customized_attributes.rb
112
+ - lib/acts_as_customized_attributes/class_methods.rb
113
+ - lib/acts_as_customized_attributes/compatibility.rb
114
+ - lib/acts_as_customized_attributes/engine.rb
115
+ - lib/acts_as_customized_attributes/instance_methods.rb
116
+ - lib/acts_as_customized_attributes/version.rb
117
+ - lib/tasks/acts_as_customized_attributes_tasks.rake
118
+ - spec/dummy/Rakefile
119
+ - spec/dummy/app/assets/javascripts/application.js
120
+ - spec/dummy/app/assets/stylesheets/application.css
121
+ - spec/dummy/app/controllers/application_controller.rb
122
+ - spec/dummy/app/helpers/application_helper.rb
123
+ - spec/dummy/app/models/order.rb
124
+ - spec/dummy/app/models/user.rb
125
+ - spec/dummy/app/views/layouts/application.html.erb
126
+ - spec/dummy/config.ru
127
+ - spec/dummy/config/application.rb
128
+ - spec/dummy/config/boot.rb
129
+ - spec/dummy/config/database.example.yml
130
+ - spec/dummy/config/database.shippable.yml
131
+ - spec/dummy/config/database.yml
132
+ - spec/dummy/config/environment.rb
133
+ - spec/dummy/config/environments/development.rb
134
+ - spec/dummy/config/environments/production.rb
135
+ - spec/dummy/config/environments/test.rb
136
+ - spec/dummy/config/initializers/backtrace_silencers.rb
137
+ - spec/dummy/config/initializers/inflections.rb
138
+ - spec/dummy/config/initializers/mime_types.rb
139
+ - spec/dummy/config/initializers/secret_token.rb
140
+ - spec/dummy/config/initializers/session_store.rb
141
+ - spec/dummy/config/initializers/wrap_parameters.rb
142
+ - spec/dummy/config/locales/en.yml
143
+ - spec/dummy/config/routes.rb
144
+ - spec/dummy/db/migrate/20141118114902_create_users.rb
145
+ - spec/dummy/db/migrate/20141118114941_create_user_customized_attributes.rb
146
+ - spec/dummy/db/migrate/20141118134833_create_orders.rb
147
+ - spec/dummy/db/migrate/20141118135027_create_order_customized_attributes.rb
148
+ - spec/dummy/db/schema.rb
149
+ - spec/dummy/log/development.log
150
+ - spec/dummy/log/test.log
151
+ - spec/dummy/public/404.html
152
+ - spec/dummy/public/422.html
153
+ - spec/dummy/public/500.html
154
+ - spec/dummy/public/favicon.ico
155
+ - spec/dummy/script/rails
156
+ - spec/factories/order.rb
157
+ - spec/factories/user.rb
158
+ - spec/models/user_spec.rb
159
+ - spec/spec_helper.rb
160
+ homepage: https://www.github.com/kaspernj/acts_as_customized_attributes
161
+ licenses: []
162
+ metadata: {}
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ! '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.2.2
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: Customized attributes for models.
183
+ test_files:
184
+ - spec/models/user_spec.rb
185
+ - spec/factories/order.rb
186
+ - spec/factories/user.rb
187
+ - spec/dummy/app/controllers/application_controller.rb
188
+ - spec/dummy/app/models/order.rb
189
+ - spec/dummy/app/models/user.rb
190
+ - spec/dummy/app/views/layouts/application.html.erb
191
+ - spec/dummy/app/assets/javascripts/application.js
192
+ - spec/dummy/app/assets/stylesheets/application.css
193
+ - spec/dummy/app/helpers/application_helper.rb
194
+ - spec/dummy/script/rails
195
+ - spec/dummy/public/500.html
196
+ - spec/dummy/public/422.html
197
+ - spec/dummy/public/404.html
198
+ - spec/dummy/public/favicon.ico
199
+ - spec/dummy/log/development.log
200
+ - spec/dummy/log/test.log
201
+ - spec/dummy/db/schema.rb
202
+ - spec/dummy/db/migrate/20141118114941_create_user_customized_attributes.rb
203
+ - spec/dummy/db/migrate/20141118135027_create_order_customized_attributes.rb
204
+ - spec/dummy/db/migrate/20141118134833_create_orders.rb
205
+ - spec/dummy/db/migrate/20141118114902_create_users.rb
206
+ - spec/dummy/Rakefile
207
+ - spec/dummy/config.ru
208
+ - spec/dummy/config/initializers/wrap_parameters.rb
209
+ - spec/dummy/config/initializers/session_store.rb
210
+ - spec/dummy/config/initializers/inflections.rb
211
+ - spec/dummy/config/initializers/mime_types.rb
212
+ - spec/dummy/config/initializers/secret_token.rb
213
+ - spec/dummy/config/initializers/backtrace_silencers.rb
214
+ - spec/dummy/config/environments/production.rb
215
+ - spec/dummy/config/environments/test.rb
216
+ - spec/dummy/config/environments/development.rb
217
+ - spec/dummy/config/application.rb
218
+ - spec/dummy/config/environment.rb
219
+ - spec/dummy/config/boot.rb
220
+ - spec/dummy/config/locales/en.yml
221
+ - spec/dummy/config/database.shippable.yml
222
+ - spec/dummy/config/database.example.yml
223
+ - spec/dummy/config/database.yml
224
+ - spec/dummy/config/routes.rb
225
+ - spec/spec_helper.rb