custom_associations 0.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +26 -0
  4. data/Rakefile +35 -0
  5. data/lib/custom_associations.rb +316 -0
  6. data/lib/custom_associations/version.rb +3 -0
  7. data/spec/dummy/README.rdoc +261 -0
  8. data/spec/dummy/Rakefile +7 -0
  9. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  10. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  11. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  12. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  13. data/spec/dummy/app/models/address.rb +2 -0
  14. data/spec/dummy/app/models/customer.rb +11 -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 +65 -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/migrate/20130604054100_create_customers.rb +16 -0
  33. data/spec/dummy/db/migrate/20130604054147_create_addresses.rb +13 -0
  34. data/spec/dummy/db/schema.rb +40 -0
  35. data/spec/dummy/public/404.html +26 -0
  36. data/spec/dummy/public/422.html +26 -0
  37. data/spec/dummy/public/500.html +25 -0
  38. data/spec/dummy/public/favicon.ico +0 -0
  39. data/spec/dummy/script/rails +6 -0
  40. data/spec/dummy/spec/factories/addresses.rb +10 -0
  41. data/spec/dummy/spec/factories/customers.rb +9 -0
  42. data/spec/spec_helper.rb +40 -0
  43. metadata +192 -0
@@ -0,0 +1,16 @@
1
+ class CreateCustomers < ActiveRecord::Migration
2
+ def change
3
+ create_table :customers do |t|
4
+ t.string :first_name
5
+ t.string :last_name
6
+ t.string :customer_number
7
+ t.date :deleted_at
8
+
9
+ t.timestamps
10
+ end
11
+ create_table :customer_addresses do |t|
12
+ t.integer :address_id
13
+ t.string :customer_number
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ class CreateAddresses < ActiveRecord::Migration
2
+ def change
3
+ create_table :addresses do |t|
4
+ t.string :line1
5
+ t.string :line2
6
+ t.string :city
7
+ t.string :state
8
+ t.string :zip
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130604054147) do
15
+
16
+ create_table "addresses", :force => true do |t|
17
+ t.string "line1"
18
+ t.string "line2"
19
+ t.string "city"
20
+ t.string "state"
21
+ t.string "zip"
22
+ t.datetime "created_at", :null => false
23
+ t.datetime "updated_at", :null => false
24
+ end
25
+
26
+ create_table "customer_addresses", :force => true do |t|
27
+ t.integer "address_id"
28
+ t.string "customer_number"
29
+ end
30
+
31
+ create_table "customers", :force => true do |t|
32
+ t.string "first_name"
33
+ t.string "last_name"
34
+ t.string "customer_number"
35
+ t.date "deleted_at"
36
+ t.datetime "created_at", :null => false
37
+ t.datetime "updated_at", :null => false
38
+ end
39
+
40
+ end
@@ -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.exe
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,10 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :address do
5
+ line1 "1234 Fake Street"
6
+ city "Foobar"
7
+ state "FL"
8
+ zip "12345"
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :customer do
5
+ first_name "John"
6
+ last_name "Doe"
7
+ customer_number "12345"
8
+ end
9
+ end
@@ -0,0 +1,40 @@
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/autorun'
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Requires supporting ruby files with custom matchers and macros, etc,
10
+ # in spec/support/ and its subdirectories.
11
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
12
+
13
+ RSpec.configure do |config|
14
+ # ## Mock Framework
15
+ #
16
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
17
+ #
18
+ # config.mock_with :mocha
19
+ # config.mock_with :flexmock
20
+ # config.mock_with :rr
21
+
22
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
23
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
24
+
25
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
26
+ # examples within a transaction, remove the following line or assign false
27
+ # instead of true.
28
+ config.use_transactional_fixtures = true
29
+
30
+ # If true, the base class of anonymous controllers will be inferred
31
+ # automatically. This will be the default behavior in future versions of
32
+ # rspec-rails.
33
+ config.infer_base_class_for_anonymous_controllers = false
34
+
35
+ # Run specs in random order to surface order dependencies. If you find an
36
+ # order dependency and want to debug it, you can fix the order by providing
37
+ # the seed, which is printed after each run.
38
+ # --seed 1234
39
+ config.order = "random"
40
+ end
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: custom_associations
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre
5
+ platform: ruby
6
+ authors:
7
+ - Joe Khoobyar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.13
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.13
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
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: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.13
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.13
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
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: factory_girl_rails
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
+ description: This ActiveRecord plugin add very basic support custom associations,
84
+ without any syntactic sugar (yet).
85
+ email:
86
+ - joe@khoobyar.name
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - lib/custom_associations.rb
92
+ - lib/custom_associations/version.rb
93
+ - MIT-LICENSE
94
+ - Rakefile
95
+ - README.rdoc
96
+ - spec/spec_helper.rb
97
+ - spec/dummy/config.ru
98
+ - spec/dummy/public/500.html
99
+ - spec/dummy/public/404.html
100
+ - spec/dummy/public/422.html
101
+ - spec/dummy/public/favicon.ico
102
+ - spec/dummy/script/rails
103
+ - spec/dummy/Rakefile
104
+ - spec/dummy/config/boot.rb
105
+ - spec/dummy/config/database.yml
106
+ - spec/dummy/config/routes.rb
107
+ - spec/dummy/config/locales/en.yml
108
+ - spec/dummy/config/initializers/session_store.rb
109
+ - spec/dummy/config/initializers/secret_token.rb
110
+ - spec/dummy/config/initializers/mime_types.rb
111
+ - spec/dummy/config/initializers/inflections.rb
112
+ - spec/dummy/config/initializers/backtrace_silencers.rb
113
+ - spec/dummy/config/initializers/wrap_parameters.rb
114
+ - spec/dummy/config/environments/test.rb
115
+ - spec/dummy/config/environments/development.rb
116
+ - spec/dummy/config/environments/production.rb
117
+ - spec/dummy/config/environment.rb
118
+ - spec/dummy/config/application.rb
119
+ - spec/dummy/db/migrate/20130604054100_create_customers.rb
120
+ - spec/dummy/db/migrate/20130604054147_create_addresses.rb
121
+ - spec/dummy/db/schema.rb
122
+ - spec/dummy/app/models/address.rb
123
+ - spec/dummy/app/models/customer.rb
124
+ - spec/dummy/app/helpers/application_helper.rb
125
+ - spec/dummy/app/views/layouts/application.html.erb
126
+ - spec/dummy/app/controllers/application_controller.rb
127
+ - spec/dummy/app/assets/stylesheets/application.css
128
+ - spec/dummy/app/assets/javascripts/application.js
129
+ - spec/dummy/spec/factories/customers.rb
130
+ - spec/dummy/spec/factories/addresses.rb
131
+ - spec/dummy/README.rdoc
132
+ homepage: http://joe.khoobyar.name
133
+ licenses:
134
+ - LGPL
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - '>'
148
+ - !ruby/object:Gem::Version
149
+ version: 1.3.1
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.0.3
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: ActiveRecord plugin to support custom associations
156
+ test_files:
157
+ - spec/spec_helper.rb
158
+ - spec/dummy/config.ru
159
+ - spec/dummy/public/500.html
160
+ - spec/dummy/public/404.html
161
+ - spec/dummy/public/422.html
162
+ - spec/dummy/public/favicon.ico
163
+ - spec/dummy/script/rails
164
+ - spec/dummy/Rakefile
165
+ - spec/dummy/config/boot.rb
166
+ - spec/dummy/config/database.yml
167
+ - spec/dummy/config/routes.rb
168
+ - spec/dummy/config/locales/en.yml
169
+ - spec/dummy/config/initializers/session_store.rb
170
+ - spec/dummy/config/initializers/secret_token.rb
171
+ - spec/dummy/config/initializers/mime_types.rb
172
+ - spec/dummy/config/initializers/inflections.rb
173
+ - spec/dummy/config/initializers/backtrace_silencers.rb
174
+ - spec/dummy/config/initializers/wrap_parameters.rb
175
+ - spec/dummy/config/environments/test.rb
176
+ - spec/dummy/config/environments/development.rb
177
+ - spec/dummy/config/environments/production.rb
178
+ - spec/dummy/config/environment.rb
179
+ - spec/dummy/config/application.rb
180
+ - spec/dummy/db/migrate/20130604054100_create_customers.rb
181
+ - spec/dummy/db/migrate/20130604054147_create_addresses.rb
182
+ - spec/dummy/db/schema.rb
183
+ - spec/dummy/app/models/address.rb
184
+ - spec/dummy/app/models/customer.rb
185
+ - spec/dummy/app/helpers/application_helper.rb
186
+ - spec/dummy/app/views/layouts/application.html.erb
187
+ - spec/dummy/app/controllers/application_controller.rb
188
+ - spec/dummy/app/assets/stylesheets/application.css
189
+ - spec/dummy/app/assets/javascripts/application.js
190
+ - spec/dummy/spec/factories/customers.rb
191
+ - spec/dummy/spec/factories/addresses.rb
192
+ - spec/dummy/README.rdoc