lazy_columns 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.
Files changed (47) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +32 -0
  4. data/lib/lazy_columns.rb +4 -0
  5. data/lib/lazy_columns/acts_as_lazy_column_loader.rb +43 -0
  6. data/lib/lazy_columns/version.rb +3 -0
  7. data/lib/tasks/lazy_columns_tasks.rake +4 -0
  8. data/spec/dummy/README.rdoc +261 -0
  9. data/spec/dummy/Rakefile +7 -0
  10. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  11. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  12. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  13. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  14. data/spec/dummy/app/models/action.rb +6 -0
  15. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  16. data/spec/dummy/config.ru +4 -0
  17. data/spec/dummy/config/application.rb +59 -0
  18. data/spec/dummy/config/boot.rb +10 -0
  19. data/spec/dummy/config/database.yml +25 -0
  20. data/spec/dummy/config/environment.rb +5 -0
  21. data/spec/dummy/config/environments/development.rb +37 -0
  22. data/spec/dummy/config/environments/production.rb +67 -0
  23. data/spec/dummy/config/environments/test.rb +37 -0
  24. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  25. data/spec/dummy/config/initializers/inflections.rb +15 -0
  26. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  27. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  28. data/spec/dummy/config/initializers/session_store.rb +8 -0
  29. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  30. data/spec/dummy/config/locales/en.yml +5 -0
  31. data/spec/dummy/config/routes.rb +58 -0
  32. data/spec/dummy/db/development.sqlite3 +0 -0
  33. data/spec/dummy/db/migrate/20130107093428_create_actions.rb +10 -0
  34. data/spec/dummy/db/schema.rb +23 -0
  35. data/spec/dummy/db/test.sqlite3 +0 -0
  36. data/spec/dummy/log/RAILS_ENV=test.log +1 -0
  37. data/spec/dummy/log/development.log +32 -0
  38. data/spec/dummy/log/test.log +10765 -0
  39. data/spec/dummy/public/404.html +26 -0
  40. data/spec/dummy/public/422.html +26 -0
  41. data/spec/dummy/public/500.html +25 -0
  42. data/spec/dummy/public/favicon.ico +0 -0
  43. data/spec/dummy/script/rails +6 -0
  44. data/spec/dummy/test/fixtures/actions.yml +9 -0
  45. data/spec/lazy_columns/acts_as_lazy_column_loader_spec.rb +27 -0
  46. data/spec/spec_helper.rb +35 -0
  47. metadata +201 -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,25 @@
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
+ </div>
24
+ </body>
25
+ </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,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ title: MyString
5
+ comments: MyText
6
+
7
+ two:
8
+ title: MyString
9
+ comments: MyText
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe LazyColumns::ActsAsLazyColumnLoader do
4
+ before(:each) do
5
+ @action = create_and_reload_action_from_db
6
+ end
7
+
8
+ describe "#lazy_column" do
9
+ it "excludes single column from active record objects" do
10
+ @action.has_attribute?(:comments).should_not == "The action should not contain the lazy :comments attribute"
11
+ end
12
+
13
+ it "loads column when requested" do
14
+ @action.comments.should == "some comments"
15
+ end
16
+
17
+ it "should not reload the object if the column was eagerly loaded" do
18
+ @action = Action.select(:comments).first
19
+ @action.should_not_receive :reload
20
+ @action.comments
21
+ end
22
+ end
23
+
24
+ def create_and_reload_action_from_db
25
+ Action.find Action.create(title: "some action", comments: "some comments")
26
+ end
27
+ end
@@ -0,0 +1,35 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../dummy/config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+ require "rspec/expectations"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ #Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ #if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ # ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ #end
16
+
17
+
18
+ # This file was generated by the `rspec --init` command. Conventionally, all
19
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
20
+ # Require this file using `require "spec_helper"` to ensure that it is only
21
+ # loaded once.
22
+ #
23
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
24
+ RSpec.configure do |config|
25
+ config.treat_symbols_as_metadata_keys_with_true_values = true
26
+ config.run_all_when_everything_filtered = true
27
+ config.filter_run :focus
28
+ config.use_transactional_fixtures = true
29
+
30
+ # Run specs in random order to surface order dependencies. If you find an
31
+ # order dependency and want to debug it, you can fix the order by providing
32
+ # the seed, which is printed after each run.
33
+ # --seed 1234
34
+ config.order = 'random'
35
+ end
metadata ADDED
@@ -0,0 +1,201 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lazy_columns
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jorge Manrubia
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.10
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.10
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.12.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.12.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec-rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.12.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.12.0
78
+ description: This plugin lets you define specific columns in ActiveRecord models to
79
+ be loaded lazily
80
+ email:
81
+ - jorge.manrubia@gmail.com
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - lib/lazy_columns/acts_as_lazy_column_loader.rb
87
+ - lib/lazy_columns/version.rb
88
+ - lib/lazy_columns.rb
89
+ - lib/tasks/lazy_columns_tasks.rake
90
+ - MIT-LICENSE
91
+ - Rakefile
92
+ - README.rdoc
93
+ - spec/dummy/app/assets/javascripts/application.js
94
+ - spec/dummy/app/assets/stylesheets/application.css
95
+ - spec/dummy/app/controllers/application_controller.rb
96
+ - spec/dummy/app/helpers/application_helper.rb
97
+ - spec/dummy/app/models/action.rb
98
+ - spec/dummy/app/views/layouts/application.html.erb
99
+ - spec/dummy/config/application.rb
100
+ - spec/dummy/config/boot.rb
101
+ - spec/dummy/config/database.yml
102
+ - spec/dummy/config/environment.rb
103
+ - spec/dummy/config/environments/development.rb
104
+ - spec/dummy/config/environments/production.rb
105
+ - spec/dummy/config/environments/test.rb
106
+ - spec/dummy/config/initializers/backtrace_silencers.rb
107
+ - spec/dummy/config/initializers/inflections.rb
108
+ - spec/dummy/config/initializers/mime_types.rb
109
+ - spec/dummy/config/initializers/secret_token.rb
110
+ - spec/dummy/config/initializers/session_store.rb
111
+ - spec/dummy/config/initializers/wrap_parameters.rb
112
+ - spec/dummy/config/locales/en.yml
113
+ - spec/dummy/config/routes.rb
114
+ - spec/dummy/config.ru
115
+ - spec/dummy/db/development.sqlite3
116
+ - spec/dummy/db/migrate/20130107093428_create_actions.rb
117
+ - spec/dummy/db/schema.rb
118
+ - spec/dummy/db/test.sqlite3
119
+ - spec/dummy/log/development.log
120
+ - spec/dummy/log/RAILS_ENV=test.log
121
+ - spec/dummy/log/test.log
122
+ - spec/dummy/public/404.html
123
+ - spec/dummy/public/422.html
124
+ - spec/dummy/public/500.html
125
+ - spec/dummy/public/favicon.ico
126
+ - spec/dummy/Rakefile
127
+ - spec/dummy/README.rdoc
128
+ - spec/dummy/script/rails
129
+ - spec/dummy/test/fixtures/actions.yml
130
+ - spec/lazy_columns/acts_as_lazy_column_loader_spec.rb
131
+ - spec/spec_helper.rb
132
+ homepage: https://github.com/jorgemanrubia/lazy_columns
133
+ licenses: []
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ segments:
145
+ - 0
146
+ hash: -498681737789299363
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ segments:
154
+ - 0
155
+ hash: -498681737789299363
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 1.8.24
159
+ signing_key:
160
+ specification_version: 3
161
+ summary: Rails plugin that let you configure ActiveRecord columns to be loaded lazily
162
+ test_files:
163
+ - spec/dummy/app/assets/javascripts/application.js
164
+ - spec/dummy/app/assets/stylesheets/application.css
165
+ - spec/dummy/app/controllers/application_controller.rb
166
+ - spec/dummy/app/helpers/application_helper.rb
167
+ - spec/dummy/app/models/action.rb
168
+ - spec/dummy/app/views/layouts/application.html.erb
169
+ - spec/dummy/config/application.rb
170
+ - spec/dummy/config/boot.rb
171
+ - spec/dummy/config/database.yml
172
+ - spec/dummy/config/environment.rb
173
+ - spec/dummy/config/environments/development.rb
174
+ - spec/dummy/config/environments/production.rb
175
+ - spec/dummy/config/environments/test.rb
176
+ - spec/dummy/config/initializers/backtrace_silencers.rb
177
+ - spec/dummy/config/initializers/inflections.rb
178
+ - spec/dummy/config/initializers/mime_types.rb
179
+ - spec/dummy/config/initializers/secret_token.rb
180
+ - spec/dummy/config/initializers/session_store.rb
181
+ - spec/dummy/config/initializers/wrap_parameters.rb
182
+ - spec/dummy/config/locales/en.yml
183
+ - spec/dummy/config/routes.rb
184
+ - spec/dummy/config.ru
185
+ - spec/dummy/db/development.sqlite3
186
+ - spec/dummy/db/migrate/20130107093428_create_actions.rb
187
+ - spec/dummy/db/schema.rb
188
+ - spec/dummy/db/test.sqlite3
189
+ - spec/dummy/log/development.log
190
+ - spec/dummy/log/RAILS_ENV=test.log
191
+ - spec/dummy/log/test.log
192
+ - spec/dummy/public/404.html
193
+ - spec/dummy/public/422.html
194
+ - spec/dummy/public/500.html
195
+ - spec/dummy/public/favicon.ico
196
+ - spec/dummy/Rakefile
197
+ - spec/dummy/README.rdoc
198
+ - spec/dummy/script/rails
199
+ - spec/dummy/test/fixtures/actions.yml
200
+ - spec/lazy_columns/acts_as_lazy_column_loader_spec.rb
201
+ - spec/spec_helper.rb