has_many_prevent_dups 0.0.1

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 (75) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/lib/has_many_prevent_dups/concat.rb +18 -0
  6. data/lib/has_many_prevent_dups/option.rb +38 -0
  7. data/lib/has_many_prevent_dups/version.rb +3 -0
  8. data/lib/has_many_prevent_dups/writers.rb +18 -0
  9. data/lib/has_many_prevent_dups.rb +9 -0
  10. data/test/dummy/README.rdoc +28 -0
  11. data/test/dummy/Rakefile +6 -0
  12. data/test/dummy/app/assets/javascripts/application.js +13 -0
  13. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  14. data/test/dummy/app/controllers/application_controller.rb +5 -0
  15. data/test/dummy/app/helpers/application_helper.rb +2 -0
  16. data/test/dummy/app/models/bean_bag.rb +2 -0
  17. data/test/dummy/app/models/husband.rb +10 -0
  18. data/test/dummy/app/models/lonely_model.rb +2 -0
  19. data/test/dummy/app/models/marriage.rb +6 -0
  20. data/test/dummy/app/models/wife.rb +8 -0
  21. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/test/dummy/bin/bundle +3 -0
  23. data/test/dummy/bin/rails +4 -0
  24. data/test/dummy/bin/rake +4 -0
  25. data/test/dummy/bin/setup +29 -0
  26. data/test/dummy/config/application.rb +26 -0
  27. data/test/dummy/config/boot.rb +5 -0
  28. data/test/dummy/config/database.yml +25 -0
  29. data/test/dummy/config/environment.rb +5 -0
  30. data/test/dummy/config/environments/development.rb +41 -0
  31. data/test/dummy/config/environments/production.rb +79 -0
  32. data/test/dummy/config/environments/test.rb +42 -0
  33. data/test/dummy/config/initializers/assets.rb +11 -0
  34. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  35. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  36. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  37. data/test/dummy/config/initializers/inflections.rb +16 -0
  38. data/test/dummy/config/initializers/mime_types.rb +4 -0
  39. data/test/dummy/config/initializers/session_store.rb +3 -0
  40. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  41. data/test/dummy/config/locales/en.yml +23 -0
  42. data/test/dummy/config/routes.rb +56 -0
  43. data/test/dummy/config/secrets.yml +22 -0
  44. data/test/dummy/config.ru +4 -0
  45. data/test/dummy/db/development.sqlite3 +0 -0
  46. data/test/dummy/db/migrate/20151201221132_create_bean_bags.rb +9 -0
  47. data/test/dummy/db/migrate/20151201224657_create_lonely_models.rb +8 -0
  48. data/test/dummy/db/migrate/20151201230001_create_husbands.rb +9 -0
  49. data/test/dummy/db/migrate/20151201230013_create_wives.rb +9 -0
  50. data/test/dummy/db/migrate/20151201230131_create_marriages.rb +10 -0
  51. data/test/dummy/db/schema.rb +49 -0
  52. data/test/dummy/db/test.sqlite3 +0 -0
  53. data/test/dummy/log/development.log +83 -0
  54. data/test/dummy/log/test.log +8736 -0
  55. data/test/dummy/public/404.html +67 -0
  56. data/test/dummy/public/422.html +67 -0
  57. data/test/dummy/public/500.html +66 -0
  58. data/test/dummy/public/favicon.ico +0 -0
  59. data/test/dummy/test/fixtures/bean_bags.yml +7 -0
  60. data/test/dummy/test/fixtures/husbands.yml +7 -0
  61. data/test/dummy/test/fixtures/lonely_models.yml +11 -0
  62. data/test/dummy/test/fixtures/marriages.yml +9 -0
  63. data/test/dummy/test/fixtures/wives.yml +7 -0
  64. data/test/dummy/test/models/bean_bag_test.rb +7 -0
  65. data/test/dummy/test/models/husband_test.rb +7 -0
  66. data/test/dummy/test/models/lonely_model_test.rb +7 -0
  67. data/test/dummy/test/models/marriage_test.rb +7 -0
  68. data/test/dummy/test/models/wife_test.rb +7 -0
  69. data/test/has_and_belongs_to_many_test.rb +4 -0
  70. data/test/has_many_through_test.rb +10 -0
  71. data/test/params_remain_intact_test.rb +12 -0
  72. data/test/support/concat_test.rb +39 -0
  73. data/test/support/writers_test.rb +25 -0
  74. data/test/test_helper.rb +27 -0
  75. metadata +240 -0
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,56 @@
1
+ Rails.application.routes.draw do
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+ # See how all your routes lay out with "rake routes".
4
+
5
+ # You can have the root of your site routed with "root"
6
+ # root 'welcome#index'
7
+
8
+ # Example of regular route:
9
+ # get 'products/:id' => 'catalog#view'
10
+
11
+ # Example of named route that can be invoked with purchase_url(id: product.id)
12
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
+
14
+ # Example resource route (maps HTTP verbs to controller actions automatically):
15
+ # resources :products
16
+
17
+ # Example resource route with options:
18
+ # resources :products do
19
+ # member do
20
+ # get 'short'
21
+ # post 'toggle'
22
+ # end
23
+ #
24
+ # collection do
25
+ # get 'sold'
26
+ # end
27
+ # end
28
+
29
+ # Example resource route with sub-resources:
30
+ # resources :products do
31
+ # resources :comments, :sales
32
+ # resource :seller
33
+ # end
34
+
35
+ # Example resource route with more complex sub-resources:
36
+ # resources :products do
37
+ # resources :comments
38
+ # resources :sales do
39
+ # get 'recent', on: :collection
40
+ # end
41
+ # end
42
+
43
+ # Example resource route with concerns:
44
+ # concern :toggleable do
45
+ # post 'toggle'
46
+ # end
47
+ # resources :posts, concerns: :toggleable
48
+ # resources :photos, concerns: :toggleable
49
+
50
+ # Example resource route within a namespace:
51
+ # namespace :admin do
52
+ # # Directs /admin/products/* to Admin::ProductsController
53
+ # # (app/controllers/admin/products_controller.rb)
54
+ # resources :products
55
+ # end
56
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 778ca6f0e681973c7dd9574e275e0378009ff685504ec470d055bf70aec96898e40a0da9b2ba01eee0363c13edff9458c8ad908328d1c7bd917e8afa284ba68f
15
+
16
+ test:
17
+ secret_key_base: 4806bea3d82a8c3956f9a2ac6fc0c5d5d1340de977d4eddb232defabc2a59c1d688ec45633c391bb3e44f109182c5d8e436dd65046269beb4b58c9dcd294870d
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateBeanBags < ActiveRecord::Migration
2
+ def change
3
+ create_table :bean_bags do |t|
4
+ t.string :color
5
+
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ class CreateLonelyModels < ActiveRecord::Migration
2
+ def change
3
+ create_table :lonely_models do |t|
4
+
5
+ t.timestamps null: false
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ class CreateHusbands < ActiveRecord::Migration
2
+ def change
3
+ create_table :husbands do |t|
4
+ t.string :name
5
+
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateWives < ActiveRecord::Migration
2
+ def change
3
+ create_table :wives do |t|
4
+ t.string :name
5
+
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMarriages < ActiveRecord::Migration
2
+ def change
3
+ create_table :marriages do |t|
4
+ t.belongs_to :husband, index: true, foreign_key: true
5
+ t.belongs_to :wife, index: true, foreign_key: true
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,49 @@
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 that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20151201230131) do
15
+
16
+ create_table "bean_bags", force: :cascade do |t|
17
+ t.string "color"
18
+ t.datetime "created_at", null: false
19
+ t.datetime "updated_at", null: false
20
+ end
21
+
22
+ create_table "husbands", force: :cascade do |t|
23
+ t.string "name"
24
+ t.datetime "created_at", null: false
25
+ t.datetime "updated_at", null: false
26
+ end
27
+
28
+ create_table "lonely_models", force: :cascade do |t|
29
+ t.datetime "created_at", null: false
30
+ t.datetime "updated_at", null: false
31
+ end
32
+
33
+ create_table "marriages", force: :cascade do |t|
34
+ t.integer "husband_id"
35
+ t.integer "wife_id"
36
+ t.datetime "created_at", null: false
37
+ t.datetime "updated_at", null: false
38
+ end
39
+
40
+ add_index "marriages", ["husband_id"], name: "index_marriages_on_husband_id"
41
+ add_index "marriages", ["wife_id"], name: "index_marriages_on_wife_id"
42
+
43
+ create_table "wives", force: :cascade do |t|
44
+ t.string "name"
45
+ t.datetime "created_at", null: false
46
+ t.datetime "updated_at", null: false
47
+ end
48
+
49
+ end
Binary file
@@ -0,0 +1,83 @@
1
+  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.1ms) select sqlite_version(*)
3
+  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
+ Migrating to CreateBeanBags (20151201221132)
6
+  (0.0ms) begin transaction
7
+  (0.3ms) CREATE TABLE "bean_bags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "color" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
8
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151201221132"]]
9
+  (5.1ms) commit transaction
10
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
13
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
14
+ Migrating to CreateLonelyModels (20151201224657)
15
+  (0.0ms) begin transaction
16
+  (0.3ms) CREATE TABLE "lonely_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
17
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151201224657"]]
18
+  (1.4ms) commit transaction
19
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
20
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
21
+ Migrating to CreateHusbands (20151201230001)
22
+  (0.1ms) begin transaction
23
+  (0.3ms) CREATE TABLE "husbands" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
24
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151201230001"]]
25
+  (0.9ms) commit transaction
26
+ Migrating to CreateWives (20151201230013)
27
+  (0.0ms) begin transaction
28
+  (1.4ms) CREATE TABLE "wives" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
29
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151201230013"]]
30
+  (3.7ms) commit transaction
31
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
32
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
33
+ Migrating to CreateMarriages (20151201230131)
34
+  (0.0ms) begin transaction
35
+  (0.3ms) CREATE TABLE "marriages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "husband_id" integer, "wife_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
36
+  (0.0ms) select sqlite_version(*)
37
+  (0.1ms) CREATE INDEX "index_marriages_on_husband_id" ON "marriages" ("husband_id")
38
+  (0.1ms) SELECT sql
39
+ FROM sqlite_master
40
+ WHERE name='index_marriages_on_husband_id' AND type='index'
41
+ UNION ALL
42
+ SELECT sql
43
+ FROM sqlite_temp_master
44
+ WHERE name='index_marriages_on_husband_id' AND type='index'
45
+
46
+  (0.1ms) CREATE INDEX "index_marriages_on_wife_id" ON "marriages" ("wife_id")
47
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151201230131"]]
48
+  (1.0ms) commit transaction
49
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
50
+  (0.1ms)  SELECT sql
51
+ FROM sqlite_master
52
+ WHERE name='index_marriages_on_wife_id' AND type='index'
53
+ UNION ALL
54
+ SELECT sql
55
+ FROM sqlite_temp_master
56
+ WHERE name='index_marriages_on_wife_id' AND type='index'
57
+ 
58
+  (0.1ms) SELECT sql
59
+ FROM sqlite_master
60
+ WHERE name='index_marriages_on_husband_id' AND type='index'
61
+ UNION ALL
62
+ SELECT sql
63
+ FROM sqlite_temp_master
64
+ WHERE name='index_marriages_on_husband_id' AND type='index'
65
+
66
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
67
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
68
+  (0.1ms)  SELECT sql
69
+ FROM sqlite_master
70
+ WHERE name='index_marriages_on_wife_id' AND type='index'
71
+ UNION ALL
72
+ SELECT sql
73
+ FROM sqlite_temp_master
74
+ WHERE name='index_marriages_on_wife_id' AND type='index'
75
+ 
76
+  (0.1ms) SELECT sql
77
+ FROM sqlite_master
78
+ WHERE name='index_marriages_on_husband_id' AND type='index'
79
+ UNION ALL
80
+ SELECT sql
81
+ FROM sqlite_temp_master
82
+ WHERE name='index_marriages_on_husband_id' AND type='index'
83
+