nested_attr 0.0.1.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 (62) 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/nested_attr/version.rb +3 -0
  6. data/lib/nested_attr.rb +117 -0
  7. data/lib/tasks/nested_attr_tasks.rake +4 -0
  8. data/test/dummy/README.rdoc +28 -0
  9. data/test/dummy/Rakefile +6 -0
  10. data/test/dummy/app/assets/javascripts/application.js +13 -0
  11. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  12. data/test/dummy/app/controllers/application_controller.rb +5 -0
  13. data/test/dummy/app/helpers/application_helper.rb +2 -0
  14. data/test/dummy/app/models/category.rb +3 -0
  15. data/test/dummy/app/models/post.rb +4 -0
  16. data/test/dummy/app/models/user.rb +3 -0
  17. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  18. data/test/dummy/bin/bundle +3 -0
  19. data/test/dummy/bin/rails +4 -0
  20. data/test/dummy/bin/rake +4 -0
  21. data/test/dummy/bin/setup +29 -0
  22. data/test/dummy/config/application.rb +26 -0
  23. data/test/dummy/config/boot.rb +5 -0
  24. data/test/dummy/config/database.yml +25 -0
  25. data/test/dummy/config/environment.rb +5 -0
  26. data/test/dummy/config/environments/development.rb +41 -0
  27. data/test/dummy/config/environments/production.rb +79 -0
  28. data/test/dummy/config/environments/test.rb +42 -0
  29. data/test/dummy/config/initializers/assets.rb +11 -0
  30. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  32. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  33. data/test/dummy/config/initializers/inflections.rb +16 -0
  34. data/test/dummy/config/initializers/mime_types.rb +4 -0
  35. data/test/dummy/config/initializers/session_store.rb +3 -0
  36. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  37. data/test/dummy/config/locales/en.yml +23 -0
  38. data/test/dummy/config/routes.rb +56 -0
  39. data/test/dummy/config/secrets.yml +22 -0
  40. data/test/dummy/config.ru +4 -0
  41. data/test/dummy/db/development.sqlite3 +0 -0
  42. data/test/dummy/db/migrate/20151004115649_create_users.rb +9 -0
  43. data/test/dummy/db/migrate/20151004120032_create_posts.rb +11 -0
  44. data/test/dummy/db/migrate/20151004124603_create_categories.rb +9 -0
  45. data/test/dummy/db/migrate/20151004131127_categories_posts.rb +14 -0
  46. data/test/dummy/db/schema.rb +51 -0
  47. data/test/dummy/db/test.sqlite3 +0 -0
  48. data/test/dummy/log/development.log +52 -0
  49. data/test/dummy/log/test.log +888 -0
  50. data/test/dummy/public/404.html +67 -0
  51. data/test/dummy/public/422.html +67 -0
  52. data/test/dummy/public/500.html +66 -0
  53. data/test/dummy/public/favicon.ico +0 -0
  54. data/test/dummy/test/fixtures/posts.yml +11 -0
  55. data/test/dummy/test/fixtures/users.yml +7 -0
  56. data/test/dummy/test/models/category_test.rb +7 -0
  57. data/test/dummy/test/models/post_test.rb +7 -0
  58. data/test/dummy/test/models/user_test.rb +7 -0
  59. data/test/factories.rb +31 -0
  60. data/test/nested_attr_test.rb +26 -0
  61. data/test/test_helper.rb +20 -0
  62. metadata +188 -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: 7b41a08d130d4092537f8c5a7451fe49ace48dfa11d81eaba7044e2b10249e028b285c468f580fd349280c2784a703eca560a0d4bf0e016ef3858dd743c420b3
15
+
16
+ test:
17
+ secret_key_base: b2fe4ab448a8c4e033defd410056a21a4fcfc3188d066cdb2a0a651212fa33bebff95575a195902fac13a16d864b064d7f4d91e815fefdf761c06623b6aebf5e
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 CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :username
5
+
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.integer :user_id
5
+ t.string :title
6
+ t.text :body
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :categories do |t|
4
+ t.string :name
5
+
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class CategoriesPosts < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :categories_posts, :id => false do |t|
4
+ t.integer :category_id
5
+ t.integer :post_id
6
+ end
7
+
8
+ add_index :categories_posts, [:category_id, :post_id]
9
+ end
10
+
11
+ def self.down
12
+ drop_table :categories_posts
13
+ end
14
+ end
@@ -0,0 +1,51 @@
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: 20151004131127) do
15
+
16
+ create_table "blogs", force: :cascade do |t|
17
+ t.integer "user_id"
18
+ t.string "title"
19
+ t.text "body"
20
+ t.datetime "created_at", null: false
21
+ t.datetime "updated_at", null: false
22
+ end
23
+
24
+ create_table "categories", force: :cascade do |t|
25
+ t.string "name"
26
+ t.datetime "created_at", null: false
27
+ t.datetime "updated_at", null: false
28
+ end
29
+
30
+ create_table "categories_posts", id: false, force: :cascade do |t|
31
+ t.integer "category_id"
32
+ t.integer "post_id"
33
+ end
34
+
35
+ add_index "categories_posts", ["category_id", "post_id"], name: "index_categories_posts_on_category_id_and_post_id"
36
+
37
+ create_table "posts", force: :cascade do |t|
38
+ t.integer "user_id"
39
+ t.string "title"
40
+ t.text "body"
41
+ t.datetime "created_at", null: false
42
+ t.datetime "updated_at", null: false
43
+ end
44
+
45
+ create_table "users", force: :cascade do |t|
46
+ t.string "username"
47
+ t.datetime "created_at", null: false
48
+ t.datetime "updated_at", null: false
49
+ end
50
+
51
+ end
Binary file
@@ -0,0 +1,52 @@
1
+  (446.6ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.3ms) select sqlite_version(*)
3
+  (109.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
+ Migrating to CreateUsers (20151004115649)
6
+  (0.2ms) begin transaction
7
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
8
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151004115649"]]
9
+  (136.7ms) commit transaction
10
+ Migrating to CreateBlogs (20151004115812)
11
+  (0.2ms) begin transaction
12
+  (0.8ms) CREATE TABLE "blogs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "title" varchar, "body" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
13
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151004115812"]]
14
+  (127.1ms) commit transaction
15
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
16
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
17
+ Migrating to CreatePosts (20151004120032)
18
+  (0.1ms) begin transaction
19
+  (0.3ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "title" varchar, "body" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
20
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151004120032"]]
21
+  (136.8ms) commit transaction
22
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
23
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
24
+ Migrating to CreateCategories (20151004124603)
25
+  (0.4ms) begin transaction
26
+  (0.3ms) CREATE TABLE "categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
27
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151004124603"]]
28
+  (381.7ms) commit transaction
29
+ Migrating to CategoriesPosts (20151004124704)
30
+  (0.2ms) begin transaction
31
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151004124704"]]
32
+  (129.9ms) commit transaction
33
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
34
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
35
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
36
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
37
+ Migrating to CategoriesPosts (20151004131127)
38
+  (0.1ms) begin transaction
39
+  (0.3ms) CREATE TABLE "categories_posts" ("category_id" integer, "post_id" integer) 
40
+  (0.1ms) select sqlite_version(*)
41
+  (0.1ms) CREATE INDEX "index_categories_posts_on_category_id_and_post_id" ON "categories_posts" ("category_id", "post_id")
42
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20151004131127"]]
43
+  (120.2ms) commit transaction
44
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
45
+  (0.2ms)  SELECT sql
46
+ FROM sqlite_master
47
+ WHERE name='index_categories_posts_on_category_id_and_post_id' AND type='index'
48
+ UNION ALL
49
+ SELECT sql
50
+ FROM sqlite_temp_master
51
+ WHERE name='index_categories_posts_on_category_id_and_post_id' AND type='index'
52
+