kadmin 0.1.4 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef82febec75e4f5da3d104ec4b9e1e87316154d2
4
- data.tar.gz: e99e55d0d3d5b7b4b8c355eaeaa5a2fcab22e2a1
3
+ metadata.gz: cb56dd82a58af0513f1751486f88ae71c8f1ccca
4
+ data.tar.gz: 185d7e43f4054b4fa0faca6c73f1aeea269088fb
5
5
  SHA512:
6
- metadata.gz: 152316ddf56a8c6422137f1a492bf334e0d99a40d0debde4c9a66fd3cbde3a96976c2a09f5aef2802c46a62e740fa6da2a2184e11a036c0e5ebeafff3c813fff
7
- data.tar.gz: a1b630f7e7a0f4d8ccb8cf163a5a4220015e628f8ab4a7775b472144c088af0fde55663147cdc8c66fad2032262b7159038f4d46183d68a701143b9f1440a0e0
6
+ metadata.gz: 0c9e04906af2c774c40cc1369736ac1b06a4f6faa9a1bfb5f87925b9bc109e858a08cab2b5b64ba2fed32cb58eeeaa0201b5972435f4a37e3aaae9fa7d2c95f1
7
+ data.tar.gz: 66664bea60096063a4acbb3669c6af0e4cfe15f8e9f908801eab71b37134d57de71636369a91ec57aa9882213619538b4fbb850bcf63e136221c32bd234c914a
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Kadmin
2
2
 
3
- [![GitHub release](https://img.shields.io/badge/release-0.1.4-blue.png)](https://github.com/barcoo/kadmin/releases/tag/0.1.4)
3
+ [![GitHub release](https://img.shields.io/badge/release-0.1.6-blue.png)](https://github.com/barcoo/kadmin/releases/tag/0.1.6)
4
4
 
5
5
  Collection of utility, configuration, etc., for admin areas in different projects.
6
6
 
data/lib/kadmin/form.rb CHANGED
@@ -15,15 +15,16 @@ module Kadmin
15
15
  # To use nested forms, you need to add a reader and a writer. For example,
16
16
  # for a form called Person, with potentially X nested Person forms as children,
17
17
  # you would have:
18
- # class Person
19
- # def children
20
- # [@child1, @child2]
21
- # end
18
+ # @example
19
+ # class PersonForm < Form
20
+ # def children
21
+ # [@child1, @child2]
22
+ # end
22
23
  #
23
- # def children_attributes=(attributes)
24
- # ...instantiate subforms and pass attributes...
24
+ # def children_attributes=(attributes)
25
+ # ...instantiate subforms and pass attributes...
26
+ # end
25
27
  # end
26
- # end
27
28
  class Form
28
29
  # Provides common validators and methods to add custom ones
29
30
  include ActiveModel::Validations
@@ -60,5 +61,60 @@ module Kadmin
60
61
  end
61
62
 
62
63
  # @!endgroup
64
+
65
+ # @!group Validation
66
+
67
+ validates :model_valid?
68
+
69
+ # Validates the models and merge errors back into our own errors if they
70
+ # are invalid.
71
+ # Overload if you need to validate associations.
72
+ # @example
73
+ # class PersonForm < Form
74
+ # def model_valid?
75
+ # super
76
+ # if @model&.child&.changed? && !@model.child.valid?
77
+ # @errors.add(:base, :invalid, message: 'child model is invalid')
78
+ # end
79
+ # end
80
+ # end
81
+ def model_valid?
82
+ unless @model.valid?
83
+ @model.errors.each do |attribute, error|
84
+ @errors.add(attribute, error)
85
+ end
86
+ end
87
+ end
88
+
89
+ # @!endgroup
90
+
91
+ # @!group Helper methods
92
+
93
+ class << self
94
+ # Delegates the list of attributes to the model, both readers and writers.
95
+ # If the attribute value passed is a hash and not a symbol, assumes it is
96
+ # a hash of one key, whose value is an array contained :reader, :writer, or both.
97
+ # @example
98
+ # delegate_attributes :first_name, { last_name: [:reader] }
99
+ # @param [Array<Symbol, Hash<Symbol, Array<Symbol>>>] attributes list of attributes to delegate to the model
100
+ def delegate_attributes(*attributes)
101
+ delegates = attributes.reduce([]) do |acc, attribute|
102
+ case attribute
103
+ when Hash
104
+ key, value = attribute.first
105
+ acc << key if value.include?(:reader)
106
+ acc << "#{key}=" if value.include?(:writer)
107
+ when Symbol, String
108
+ acc << attribute
109
+ else
110
+ raise(ArgumentError, 'Attribute must be one of: Hash, Symbol, String')
111
+ end
112
+
113
+ delegate(*delegates, to: model)
114
+ end
115
+ end
116
+ end
117
+
118
+ # @!endgroup
63
119
  end
64
120
  end
@@ -1,3 +1,3 @@
1
1
  module Kadmin
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.6'.freeze
3
3
  end
@@ -0,0 +1,8 @@
1
+ class Group < ActiveRecord::Base
2
+ has_many :group_people, dependent: :destroy, autosave: true
3
+ has_many :people, through: :group_people
4
+ belongs_to :owner, class_name: 'Person'
5
+
6
+ validates :name, presence: true, length: { in: 1..254 },
7
+ format: { with: /[a-zA-Z0-9\-_\s]+/, message: 'only alphanumerics, dashes, underscores, and spaces' }
8
+ end
@@ -0,0 +1,6 @@
1
+ class GroupPerson < ActiveRecord::Base
2
+ belongs_to :group
3
+ belongs_to :person
4
+
5
+ validates :person_id, uniqueness: { scope: :group_id, message: 'can only be part once of the same group' }
6
+ end
@@ -1,6 +1,15 @@
1
1
  class Person < ActiveRecord::Base
2
- has_many :relationships, autosave: true, dependent: :destroy, foreign_key: 'person_from'
2
+ has_many :group_people, dependent: :destroy, autosave: true
3
+ has_many :groups, through: :group_people
4
+ has_many :owned_groups, class_name: 'Group', foreign_key: 'owner_id', dependent: :nullify, autosave: true
3
5
 
4
- has_many :children, { autosave: true, dependent: :destroy, foreign_key: 'person_to' }, -> { where(name: 'child') }
5
- has_one :father, { autosave: true, dependent: :destroy, foreign_key: 'person_to' }, -> { where(name: 'father') }
6
+ validates :first_name, presence: true, length: { in: 2..254 }
7
+ validates :last_name, presence: true, length: { in: 2..254 }
8
+ validates :sex, presence: true, length: { is: 1 }, inclusion: { in: %w(m f o), message: 'one of m (male), f (female), or o (other)' }
9
+ validate :valid_date_of_birth?
10
+
11
+ def valid_date_of_birth?
12
+ return date_of_birth.nil? || (date_of_birth.is_a?(Date) && date_of_birth < Date.current)
13
+ end
14
+ private :valid_date_of_birth?
6
15
  end
@@ -20,4 +20,10 @@
20
20
  # available at http://guides.rubyonrails.org/i18n.html.
21
21
 
22
22
  en:
23
- hello: "Hello world"
23
+ activerecord:
24
+ models:
25
+ person:
26
+ sex:
27
+ m: "Male"
28
+ f: "Female"
29
+ o: "Other"
Binary file
@@ -3,7 +3,7 @@ class CreatePeople < ActiveRecord::Migration
3
3
  create_table :people do |t|
4
4
  t.string :first_name
5
5
  t.string :last_name
6
- t.integer :sex, limit: 1 # enum: 0 => M, 1 => F, 2 => Undisclosed
6
+ t.string :sex, limit: 1 # enum: m, f, o (other)
7
7
  t.date :date_of_birth
8
8
  t.timestamps null: false
9
9
  end
@@ -0,0 +1,11 @@
1
+ class CreateGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :groups do |t|
4
+ t.string :name
5
+ t.integer :owner_id
6
+ t.timestamps null: false
7
+
8
+ t.index [:owner_id], name: 'groups_owner_lookup'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateGroupPeople < ActiveRecord::Migration
2
+ def change
3
+ create_table :group_people do |t|
4
+ t.references :group
5
+ t.references :person
6
+ t.timestamps null: false
7
+
8
+ t.index [:group_id, :person_id], unique: true, name: 'group_people_lookup'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,43 @@
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: 20161006134746) do
15
+
16
+ create_table "group_people", force: :cascade do |t|
17
+ t.integer "group_id"
18
+ t.integer "person_id"
19
+ t.datetime "created_at", null: false
20
+ t.datetime "updated_at", null: false
21
+ end
22
+
23
+ add_index "group_people", ["group_id", "person_id"], name: "group_people_lookup", unique: true
24
+
25
+ create_table "groups", force: :cascade do |t|
26
+ t.string "name"
27
+ t.integer "owner_id"
28
+ t.datetime "created_at", null: false
29
+ t.datetime "updated_at", null: false
30
+ end
31
+
32
+ add_index "groups", ["owner_id"], name: "groups_owner_lookup"
33
+
34
+ create_table "people", force: :cascade do |t|
35
+ t.string "first_name"
36
+ t.string "last_name"
37
+ t.string "sex", limit: 1
38
+ t.date "date_of_birth"
39
+ t.datetime "created_at", null: false
40
+ t.datetime "updated_at", null: false
41
+ end
42
+
43
+ end
@@ -0,0 +1,28 @@
1
+ module Forms
2
+ class GroupForm < Kadmin::Form
3
+ delegate_attributes :name, :owner_id
4
+
5
+ def initialize(*args)
6
+ super
7
+ raise(ArgumentError, 'Model given should be a group') unless @model.is_a?(Group)
8
+ end
9
+
10
+ def owner
11
+ owner = @model.owner || Person.new
12
+ return Forms::PersonForm.new(owner)
13
+ end
14
+
15
+ def owner_attributes=(attributes)
16
+ form = owner
17
+ form.assign_attributes(attributes)
18
+ end
19
+
20
+ def model_valid?
21
+ super
22
+
23
+ if @model&.owner&.changed? && !@model.owner.valid?
24
+ @errors.add(:base, :invalid, message: 'owner has invalid attributes')
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ module Forms
2
+ class PersonForm < Kadmin::Form
3
+ delegate_attributes :sex, :first_name, :last_name, date_of_birth: [:reader]
4
+
5
+ validates :adult?
6
+
7
+ def initialize(*args)
8
+ super
9
+ raise(ArgumentError, 'Model given should be a person') unless @model.is_a?(Person)
10
+ end
11
+
12
+ # @param [Array<String>] value array where 0 is the year, 1 is the month, 2 is the day
13
+ def date_of_birth=(value)
14
+ year = value[0].to_i
15
+ month = value[1].to_i
16
+ day = value[2].to_i
17
+
18
+ @model.date_of_birth = Date.new(year, month, day)
19
+ end
20
+
21
+ def adult?
22
+ cutoff_date = 18.years.ago.beginning_of_day
23
+ if @model.date_of_birth > cutoff_date
24
+ @errors.add(:date_of_birth, :invalid, message: 'must be 18 years old')
25
+ end
26
+ end
27
+ end
28
+ end
@@ -9190,3 +9190,238 @@ Processing by RailsAdmin::AuthController#login as HTML
9190
9190
  Rendered /Users/npepinpe/work/github/offerista/RailsAdmin/app/views/rails_admin/auth/login.html.erb within layouts/rails_admin/application (0.9ms)
9191
9191
  Rendered /Users/npepinpe/work/github/offerista/RailsAdmin/app/views/rails_admin/_alerts.html.erb (0.1ms)
9192
9192
  Completed 200 OK in 23ms (Views: 22.9ms | ActiveRecord: 0.0ms)
9193
+  (1.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9194
+  (0.1ms) select sqlite_version(*)
9195
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9196
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9197
+ Migrating to CreatePeople (20161006114509)
9198
+  (0.0ms) begin transaction
9199
+  (0.3ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9200
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9201
+  (1.3ms) commit transaction
9202
+ Migrating to CreateRelationships (20161006121212)
9203
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9204
+ Migrating to CreateRelationships (20161006121212)
9205
+  (0.1ms) begin transaction
9206
+  (0.8ms) CREATE TABLE "relationships" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "person_from_id" integer, "person_to_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
9207
+  (0.1ms) select sqlite_version(*)
9208
+  (0.5ms) CREATE INDEX "relationships_person_lookup" ON "relationships" ("person_from", "person_to", "name")
9209
+  (0.5ms) rollback transaction
9210
+  (18.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9211
+  (0.1ms) select sqlite_version(*)
9212
+  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9213
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9214
+ Migrating to CreatePeople (20161006114509)
9215
+  (0.1ms) begin transaction
9216
+  (0.4ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9217
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9218
+  (1.1ms) commit transaction
9219
+ Migrating to CreateRelationships (20161006121212)
9220
+  (0.0ms) begin transaction
9221
+  (0.3ms) CREATE TABLE "relationships" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "person_from_id" integer, "person_to_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9222
+  (0.5ms) CREATE INDEX "relationships_person_lookup" ON "relationships" ("person_from", "person_to", "name")
9223
+  (0.3ms) rollback transaction
9224
+  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9225
+  (0.1ms) select sqlite_version(*)
9226
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9227
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9228
+ Migrating to CreatePeople (20161006114509)
9229
+  (0.0ms) begin transaction
9230
+  (0.4ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9231
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9232
+  (0.9ms) commit transaction
9233
+ Migrating to CreatePersonRelationships (20161006121212)
9234
+  (0.0ms) begin transaction
9235
+  (0.3ms) CREATE TABLE "person_relationships" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "person_from_id" integer, "person_to_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9236
+  (0.4ms) CREATE INDEX "relationships_person_lookup" ON "person_relationships" ("person_from", "person_to", "name")
9237
+  (0.4ms) rollback transaction
9238
+  (192.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9239
+  (0.1ms) select sqlite_version(*)
9240
+  (2.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9241
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9242
+ Migrating to CreatePeople (20161006114509)
9243
+  (0.0ms) begin transaction
9244
+  (0.3ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9245
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9246
+  (177.7ms) commit transaction
9247
+ Migrating to CreatePersonRelationships (20161006121212)
9248
+  (0.1ms) begin transaction
9249
+  (0.4ms) CREATE TABLE "person_relationships" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "person_from" integer, "person_to" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9250
+  (0.1ms) CREATE INDEX "relationships_person_lookup" ON "person_relationships" ("person_from", "person_to", "name")
9251
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006121212"]]
9252
+  (97.2ms) commit transaction
9253
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9254
+  (0.1ms)  SELECT sql
9255
+ FROM sqlite_master
9256
+ WHERE name='relationships_person_lookup' AND type='index'
9257
+ UNION ALL
9258
+ SELECT sql
9259
+ FROM sqlite_temp_master
9260
+ WHERE name='relationships_person_lookup' AND type='index'
9261
+ 
9262
+  (0.1ms) begin transaction
9263
+ SQL (0.4ms) INSERT INTO "people" ("first_name", "last_name", "date_of_birth", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["first_name", "John"], ["last_name", "Smith"], ["date_of_birth", "1960-10-06"], ["created_at", "2016-10-06 13:29:47.096073"], ["updated_at", "2016-10-06 13:29:47.096073"]]
9264
+  (1.2ms) commit transaction
9265
+  (0.1ms) begin transaction
9266
+ SQL (0.4ms) UPDATE "people" SET "sex" = ?, "updated_at" = ? WHERE "people"."id" = ? [["sex", "m"], ["updated_at", "2016-10-06 13:29:58.552750"], ["id", 1]]
9267
+  (1.0ms) commit transaction
9268
+  (0.2ms) begin transaction
9269
+ SQL (0.3ms) INSERT INTO "people" ("first_name", "last_name", "sex", "date_of_birth", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["first_name", "Tim"], ["last_name", "Smith"], ["sex", "m"], ["date_of_birth", "2003-10-06"], ["created_at", "2016-10-06 13:30:21.353051"], ["updated_at", "2016-10-06 13:30:21.353051"]]
9270
+  (3.1ms) commit transaction
9271
+ PersonRelationship Load (0.2ms) SELECT "person_relationships".* FROM "person_relationships" WHERE "person_relationships"."person_from" = ? LIMIT 1 [["person_from", 2]]
9272
+  (0.1ms) begin transaction
9273
+  (0.1ms) rollback transaction
9274
+  (0.1ms) begin transaction
9275
+ SQL (0.4ms) INSERT INTO "person_relationships" ("person_from", "person_to", "name", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["person_from", 2], ["person_to", 1], ["name", "child"], ["created_at", "2016-10-06 13:31:48.422609"], ["updated_at", "2016-10-06 13:31:48.422609"]]
9276
+  (1.1ms) commit transaction
9277
+ PersonRelationship Load (0.2ms) SELECT "person_relationships".* FROM "person_relationships" WHERE "person_relationships"."person_to" = ? [["person_to", 1]]
9278
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9279
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9280
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9281
+ Person Load (0.2ms) SELECT "people".* FROM "people" INNER JOIN "person_relationships" ON "people"."id" = "person_relationships"."person_to" WHERE "person_relationships"."person_from" = ? [["person_from", 1]]
9282
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9283
+ Person Load (0.2ms) SELECT "people".* FROM "people" INNER JOIN "person_relationships" ON "people"."id" = "person_relationships"."person_from" WHERE "person_relationships"."person_from" = ? [["person_from", 1]]
9284
+ PersonRelationship Load (0.1ms) SELECT "person_relationships".* FROM "person_relationships" ORDER BY "person_relationships"."id" ASC LIMIT 1
9285
+ PersonRelationship Load (0.1ms) SELECT "person_relationships".* FROM "person_relationships" ORDER BY "person_relationships"."id" ASC LIMIT 1
9286
+ Person Load (0.2ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9287
+ Person Load (0.2ms) SELECT "people".* FROM "people" INNER JOIN "person_relationships" ON "people"."id" = "person_relationships"."person_to" WHERE "person_relationships"."person_from" = ? [["person_from", 1]]
9288
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9289
+  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9290
+  (0.1ms) select sqlite_version(*)
9291
+  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9292
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9293
+ Migrating to CreatePeople (20161006114509)
9294
+  (0.0ms) begin transaction
9295
+  (0.3ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9296
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9297
+  (1.0ms) commit transaction
9298
+ Migrating to CreateGroups (20161006134459)
9299
+  (0.0ms) begin transaction
9300
+  (0.3ms) CREATE TABLE "groups" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "owner_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9301
+  (0.1ms) CREATE INDEX "groups_owner_lookup" ON "groups" ("owner_id")
9302
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134459"]]
9303
+  (1.0ms) commit transaction
9304
+ Migrating to CreateGroupPeople (20161006134746)
9305
+  (0.0ms) begin transaction
9306
+  (0.3ms) CREATE TABLE "group_people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "groups_id" integer, "people_id" integer, "join_date" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
9307
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134746"]]
9308
+  (1.1ms) commit transaction
9309
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9310
+  (0.1ms)  SELECT sql
9311
+ FROM sqlite_master
9312
+ WHERE name='groups_owner_lookup' AND type='index'
9313
+ UNION ALL
9314
+ SELECT sql
9315
+ FROM sqlite_temp_master
9316
+ WHERE name='groups_owner_lookup' AND type='index'
9317
+ 
9318
+  (0.1ms) begin transaction
9319
+ SQL (0.4ms) INSERT INTO "people" ("first_name", "last_name", "sex", "date_of_birth", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["first_name", "John"], ["last_name", "Smith"], ["sex", "m"], ["date_of_birth", "1960-10-06"], ["created_at", "2016-10-06 13:50:39.444546"], ["updated_at", "2016-10-06 13:50:39.444546"]]
9320
+  (1.0ms) commit transaction
9321
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9322
+  (0.1ms) begin transaction
9323
+ SQL (0.5ms) INSERT INTO "groups" ("name", "owner_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "The Smiths"], ["owner_id", 1], ["created_at", "2016-10-06 13:52:31.965101"], ["updated_at", "2016-10-06 13:52:31.965101"]]
9324
+  (1.3ms) commit transaction
9325
+ Group Load (0.2ms) SELECT "groups".* FROM "groups" WHERE "groups"."owner_id" = ? [["owner_id", 1]]
9326
+ Group Load (0.5ms) SELECT "groups".* FROM "groups" INNER JOIN "group_people" ON "groups"."id" = "group_people"."group_id" WHERE "group_people"."person_id" = ? [[nil, 1]]
9327
+  (0.1ms) begin transaction
9328
+  (0.1ms) rollback transaction
9329
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9330
+  (0.1ms) select sqlite_version(*)
9331
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9332
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9333
+ Migrating to CreatePeople (20161006114509)
9334
+  (0.0ms) begin transaction
9335
+  (0.4ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9336
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9337
+  (1.1ms) commit transaction
9338
+ Migrating to CreateGroups (20161006134459)
9339
+  (0.0ms) begin transaction
9340
+  (0.3ms) CREATE TABLE "groups" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "owner_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9341
+  (0.1ms) CREATE INDEX "groups_owner_lookup" ON "groups" ("owner_id")
9342
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134459"]]
9343
+  (1.1ms) commit transaction
9344
+ Migrating to CreateGroupPeople (20161006134746)
9345
+  (0.0ms) begin transaction
9346
+  (0.3ms) CREATE TABLE "group_people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "group_id" integer, "person_id" integer, "join_date" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
9347
+  (0.1ms) CREATE INDEX "group_people_lookup" ON "group_people" ("group_id", "person_id", "join_date")
9348
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134746"]]
9349
+  (1.5ms) commit transaction
9350
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9351
+  (0.1ms) SELECT sql
9352
+ FROM sqlite_master
9353
+ WHERE name='group_people_lookup' AND type='index'
9354
+ UNION ALL
9355
+ SELECT sql
9356
+ FROM sqlite_temp_master
9357
+ WHERE name='group_people_lookup' AND type='index'
9358
+
9359
+  (0.1ms)  SELECT sql
9360
+ FROM sqlite_master
9361
+ WHERE name='groups_owner_lookup' AND type='index'
9362
+ UNION ALL
9363
+ SELECT sql
9364
+ FROM sqlite_temp_master
9365
+ WHERE name='groups_owner_lookup' AND type='index'
9366
+ 
9367
+  (0.1ms) begin transaction
9368
+ SQL (0.4ms) INSERT INTO "people" ("first_name", "last_name", "sex", "date_of_birth", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["first_name", "John"], ["last_name", "Smith"], ["sex", "m"], ["date_of_birth", "1960-10-06"], ["created_at", "2016-10-06 13:54:24.199800"], ["updated_at", "2016-10-06 13:54:24.199800"]]
9369
+  (1.5ms) commit transaction
9370
+  (0.2ms) begin transaction
9371
+ SQL (0.3ms) INSERT INTO "groups" ("name", "owner_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "The Smiths"], ["owner_id", 1], ["created_at", "2016-10-06 13:54:26.888319"], ["updated_at", "2016-10-06 13:54:26.888319"]]
9372
+  (1.1ms) commit transaction
9373
+  (0.1ms) begin transaction
9374
+ SQL (0.3ms) INSERT INTO "group_people" ("group_id", "person_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["group_id", 1], ["person_id", 1], ["created_at", "2016-10-06 13:54:29.391167"], ["updated_at", "2016-10-06 13:54:29.391167"]]
9375
+  (1.2ms) commit transaction
9376
+ Person Load (0.2ms) SELECT "people".* FROM "people" INNER JOIN "group_people" ON "people"."id" = "group_people"."person_id" WHERE "group_people"."group_id" = ? [["group_id", 1]]
9377
+  (1.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
9378
+  (0.1ms) select sqlite_version(*)
9379
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
9380
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9381
+ Migrating to CreatePeople (20161006114509)
9382
+  (0.0ms) begin transaction
9383
+  (0.3ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9384
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9385
+  (1.2ms) commit transaction
9386
+ Migrating to CreateGroups (20161006134459)
9387
+  (0.0ms) begin transaction
9388
+  (0.3ms) CREATE TABLE "groups" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "owner_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9389
+  (0.1ms) CREATE INDEX "groups_owner_lookup" ON "groups" ("owner_id")
9390
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134459"]]
9391
+  (1.5ms) commit transaction
9392
+ Migrating to CreateGroupPeople (20161006134746)
9393
+  (0.1ms) begin transaction
9394
+  (0.3ms) CREATE TABLE "group_people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "group_id" integer, "person_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
9395
+  (0.4ms) CREATE UNIQUE INDEX "group_people_lookup" ON "group_people" ("group_id", "person_id")
9396
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134746"]]
9397
+  (1.3ms) commit transaction
9398
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
9399
+  (0.1ms) SELECT sql
9400
+ FROM sqlite_master
9401
+ WHERE name='group_people_lookup' AND type='index'
9402
+ UNION ALL
9403
+ SELECT sql
9404
+ FROM sqlite_temp_master
9405
+ WHERE name='group_people_lookup' AND type='index'
9406
+
9407
+  (0.1ms)  SELECT sql
9408
+ FROM sqlite_master
9409
+ WHERE name='groups_owner_lookup' AND type='index'
9410
+ UNION ALL
9411
+ SELECT sql
9412
+ FROM sqlite_temp_master
9413
+ WHERE name='groups_owner_lookup' AND type='index'
9414
+ 
9415
+  (0.0ms) begin transaction
9416
+ SQL (0.4ms) INSERT INTO "people" ("first_name", "last_name", "sex", "date_of_birth", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["first_name", "John"], ["last_name", "Smith"], ["sex", "m"], ["date_of_birth", "1960-10-06"], ["created_at", "2016-10-06 14:06:29.393094"], ["updated_at", "2016-10-06 14:06:29.393094"]]
9417
+  (1.0ms) commit transaction
9418
+  (0.0ms) begin transaction
9419
+ SQL (0.3ms) INSERT INTO "groups" ("name", "owner_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "The Smiths"], ["owner_id", 1], ["created_at", "2016-10-06 14:06:32.355702"], ["updated_at", "2016-10-06 14:06:32.355702"]]
9420
+  (1.3ms) commit transaction
9421
+ Group Load (0.1ms) SELECT "groups".* FROM "groups" ORDER BY "groups"."id" ASC LIMIT 1
9422
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
9423
+  (0.1ms) begin transaction
9424
+ GroupPerson Exists (0.1ms) SELECT 1 AS one FROM "group_people" WHERE ("group_people"."person_id" = 1 AND "group_people"."group_id" = 1) LIMIT 1
9425
+ SQL (0.4ms) INSERT INTO "group_people" ("group_id", "person_id", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["group_id", 1], ["person_id", 1], ["created_at", "2016-10-06 14:07:40.650822"], ["updated_at", "2016-10-06 14:07:40.650822"]]
9426
+  (1.1ms) commit transaction
9427
+ Person Load (0.2ms) SELECT "people".* FROM "people" INNER JOIN "group_people" ON "people"."id" = "group_people"."person_id" WHERE "group_people"."group_id" = ? [["group_id", 1]]
@@ -0,0 +1,129 @@
1
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.1ms) select sqlite_version(*)
3
+  (1.2ms) 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 CreatePeople (20161006114509)
6
+  (0.0ms) begin transaction
7
+  (0.3ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
8
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
9
+  (1.2ms) commit transaction
10
+ Migrating to CreatePersonRelationships (20161006121212)
11
+  (0.3ms) begin transaction
12
+  (0.4ms) CREATE TABLE "person_relationships" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "person_from" integer, "person_to" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
13
+  (0.1ms) CREATE INDEX "relationships_person_lookup" ON "person_relationships" ("person_from", "person_to", "name")
14
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006121212"]]
15
+  (1.3ms) commit transaction
16
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
17
+  (0.1ms)  SELECT sql
18
+ FROM sqlite_master
19
+ WHERE name='relationships_person_lookup' AND type='index'
20
+ UNION ALL
21
+ SELECT sql
22
+ FROM sqlite_temp_master
23
+ WHERE name='relationships_person_lookup' AND type='index'
24
+ 
25
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
26
+  (0.1ms) select sqlite_version(*)
27
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
28
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
29
+ Migrating to CreatePeople (20161006114509)
30
+  (0.1ms) begin transaction
31
+  (0.4ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
32
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
33
+  (1.2ms) commit transaction
34
+ Migrating to CreateGroups (20161006134459)
35
+  (0.0ms) begin transaction
36
+  (0.3ms) CREATE TABLE "groups" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "owner_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
37
+  (0.1ms) CREATE INDEX "groups_owner_lookup" ON "groups" ("owner_id")
38
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134459"]]
39
+  (1.2ms) commit transaction
40
+ Migrating to CreateGroupPeople (20161006134746)
41
+  (0.0ms) begin transaction
42
+  (0.3ms) CREATE TABLE "group_people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "groups_id" integer, "people_id" integer, "join_date" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
43
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134746"]]
44
+  (1.1ms) commit transaction
45
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
46
+  (0.1ms)  SELECT sql
47
+ FROM sqlite_master
48
+ WHERE name='groups_owner_lookup' AND type='index'
49
+ UNION ALL
50
+ SELECT sql
51
+ FROM sqlite_temp_master
52
+ WHERE name='groups_owner_lookup' AND type='index'
53
+ 
54
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
55
+  (0.1ms) select sqlite_version(*)
56
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
57
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
58
+ Migrating to CreatePeople (20161006114509)
59
+  (0.0ms) begin transaction
60
+  (0.3ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
61
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
62
+  (1.1ms) commit transaction
63
+ Migrating to CreateGroups (20161006134459)
64
+  (0.0ms) begin transaction
65
+  (0.3ms) CREATE TABLE "groups" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "owner_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
66
+  (0.1ms) CREATE INDEX "groups_owner_lookup" ON "groups" ("owner_id")
67
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134459"]]
68
+  (1.2ms) commit transaction
69
+ Migrating to CreateGroupPeople (20161006134746)
70
+  (0.0ms) begin transaction
71
+  (0.3ms) CREATE TABLE "group_people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "group_id" integer, "person_id" integer, "join_date" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
72
+  (0.1ms) CREATE INDEX "group_people_lookup" ON "group_people" ("group_id", "person_id", "join_date")
73
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134746"]]
74
+  (1.1ms) commit transaction
75
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
76
+  (0.1ms) SELECT sql
77
+ FROM sqlite_master
78
+ WHERE name='group_people_lookup' AND type='index'
79
+ UNION ALL
80
+ SELECT sql
81
+ FROM sqlite_temp_master
82
+ WHERE name='group_people_lookup' AND type='index'
83
+
84
+  (0.1ms)  SELECT sql
85
+ FROM sqlite_master
86
+ WHERE name='groups_owner_lookup' AND type='index'
87
+ UNION ALL
88
+ SELECT sql
89
+ FROM sqlite_temp_master
90
+ WHERE name='groups_owner_lookup' AND type='index'
91
+ 
92
+  (1.6ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
93
+  (0.1ms) select sqlite_version(*)
94
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
95
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
96
+ Migrating to CreatePeople (20161006114509)
97
+  (0.0ms) begin transaction
98
+  (0.3ms) CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "sex" varchar(1), "date_of_birth" date, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
99
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006114509"]]
100
+  (1.2ms) commit transaction
101
+ Migrating to CreateGroups (20161006134459)
102
+  (0.0ms) begin transaction
103
+  (0.3ms) CREATE TABLE "groups" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "owner_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
104
+  (0.1ms) CREATE INDEX "groups_owner_lookup" ON "groups" ("owner_id")
105
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134459"]]
106
+  (1.0ms) commit transaction
107
+ Migrating to CreateGroupPeople (20161006134746)
108
+  (0.0ms) begin transaction
109
+  (0.3ms) CREATE TABLE "group_people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "group_id" integer, "person_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
110
+  (0.3ms) CREATE UNIQUE INDEX "group_people_lookup" ON "group_people" ("group_id", "person_id")
111
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161006134746"]]
112
+  (1.7ms) commit transaction
113
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
114
+  (0.1ms) SELECT sql
115
+ FROM sqlite_master
116
+ WHERE name='group_people_lookup' AND type='index'
117
+ UNION ALL
118
+ SELECT sql
119
+ FROM sqlite_temp_master
120
+ WHERE name='group_people_lookup' AND type='index'
121
+
122
+  (0.1ms)  SELECT sql
123
+ FROM sqlite_master
124
+ WHERE name='groups_owner_lookup' AND type='index'
125
+ UNION ALL
126
+ SELECT sql
127
+ FROM sqlite_temp_master
128
+ WHERE name='groups_owner_lookup' AND type='index'
129
+ 
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class PersonTest < ActiveSupport::TestCase
3
+ class GroupPersonTest < ActiveSupport::TestCase
4
4
  # test "the truth" do
5
5
  # assert true
6
6
  # end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ChildTest < ActiveSupport::TestCase
3
+ class GroupTest < ActiveSupport::TestCase
4
4
  # test "the truth" do
5
5
  # assert true
6
6
  # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Pepin-Perreault
@@ -109,9 +109,9 @@ extra_rdoc_files: []
109
109
  files:
110
110
  - README.md
111
111
  - Rakefile
112
- - app/assets/javascripts/rails_admin/application.js
113
- - app/assets/stylesheets/rails_admin/application.scss
114
- - app/assets/stylesheets/rails_admin/finder.scss
112
+ - app/assets/javascripts/kadmin/application.js
113
+ - app/assets/stylesheets/kadmin/application.scss
114
+ - app/assets/stylesheets/kadmin/finder.scss
115
115
  - app/controllers/kadmin/application_controller.rb
116
116
  - app/controllers/kadmin/auth_controller.rb
117
117
  - app/controllers/kadmin/concerns/authorized_user.rb
@@ -153,8 +153,9 @@ files:
153
153
  - test/dummy/app/controllers/application_controller.rb
154
154
  - test/dummy/app/controllers/authorized_controller.rb
155
155
  - test/dummy/app/helpers/application_helper.rb
156
+ - test/dummy/app/models/group.rb
157
+ - test/dummy/app/models/group_person.rb
156
158
  - test/dummy/app/models/person.rb
157
- - test/dummy/app/models/relationship.rb
158
159
  - test/dummy/app/views/admin/index.html.erb
159
160
  - test/dummy/app/views/authorized/index.html.erb
160
161
  - test/dummy/app/views/layouts/application.html.erb
@@ -183,17 +184,25 @@ files:
183
184
  - test/dummy/config/routes.rb
184
185
  - test/dummy/config/secrets.yml
185
186
  - test/dummy/db/dummy_development.sqlite3
187
+ - test/dummy/db/dummy_test.sqlite3
186
188
  - test/dummy/db/migrate/20161006114509_create_people.rb
187
- - test/dummy/db/migrate/20161006121212_create_relationships.rb
189
+ - test/dummy/db/migrate/20161006134459_create_groups.rb
190
+ - test/dummy/db/migrate/20161006134746_create_group_people.rb
191
+ - test/dummy/db/schema.rb
192
+ - test/dummy/lib/forms/group_form.rb
193
+ - test/dummy/lib/forms/person_form.rb
188
194
  - test/dummy/log/development.log
195
+ - test/dummy/log/test.log
189
196
  - test/dummy/public/404.html
190
197
  - test/dummy/public/422.html
191
198
  - test/dummy/public/500.html
192
199
  - test/dummy/public/favicon.ico
193
200
  - test/dummy/test/fixtures/children.yml
201
+ - test/dummy/test/fixtures/group_people.yml
202
+ - test/dummy/test/fixtures/groups.yml
194
203
  - test/dummy/test/fixtures/people.yml
195
- - test/dummy/test/models/child_test.rb
196
- - test/dummy/test/models/person_test.rb
204
+ - test/dummy/test/models/group_person_test.rb
205
+ - test/dummy/test/models/group_test.rb
197
206
  - test/dummy/tmp/cache/assets/sprockets/v3.0/-E/-E7l5lmqv4YBdAJz55GQp5nq67ZkFAo6Bi5OjNk5wH0.cache
198
207
  - test/dummy/tmp/cache/assets/sprockets/v3.0/-G/-GztuOFiffIyLHRd9L2OrRr8LvduErePFmti2KiEWnM.cache
199
208
  - test/dummy/tmp/cache/assets/sprockets/v3.0/-K/-Ki0cNlcEH7alAxkgEojJTity_R8pKPW8lod9PdmQp4.cache
@@ -487,8 +496,9 @@ test_files:
487
496
  - test/dummy/app/controllers/application_controller.rb
488
497
  - test/dummy/app/controllers/authorized_controller.rb
489
498
  - test/dummy/app/helpers/application_helper.rb
499
+ - test/dummy/app/models/group.rb
500
+ - test/dummy/app/models/group_person.rb
490
501
  - test/dummy/app/models/person.rb
491
- - test/dummy/app/models/relationship.rb
492
502
  - test/dummy/app/views/admin/index.html.erb
493
503
  - test/dummy/app/views/authorized/index.html.erb
494
504
  - test/dummy/app/views/layouts/application.html.erb
@@ -517,9 +527,15 @@ test_files:
517
527
  - test/dummy/config/secrets.yml
518
528
  - test/dummy/config.ru
519
529
  - test/dummy/db/dummy_development.sqlite3
530
+ - test/dummy/db/dummy_test.sqlite3
520
531
  - test/dummy/db/migrate/20161006114509_create_people.rb
521
- - test/dummy/db/migrate/20161006121212_create_relationships.rb
532
+ - test/dummy/db/migrate/20161006134459_create_groups.rb
533
+ - test/dummy/db/migrate/20161006134746_create_group_people.rb
534
+ - test/dummy/db/schema.rb
535
+ - test/dummy/lib/forms/group_form.rb
536
+ - test/dummy/lib/forms/person_form.rb
522
537
  - test/dummy/log/development.log
538
+ - test/dummy/log/test.log
523
539
  - test/dummy/public/404.html
524
540
  - test/dummy/public/422.html
525
541
  - test/dummy/public/500.html
@@ -527,9 +543,11 @@ test_files:
527
543
  - test/dummy/Rakefile
528
544
  - test/dummy/README.rdoc
529
545
  - test/dummy/test/fixtures/children.yml
546
+ - test/dummy/test/fixtures/group_people.yml
547
+ - test/dummy/test/fixtures/groups.yml
530
548
  - test/dummy/test/fixtures/people.yml
531
- - test/dummy/test/models/child_test.rb
532
- - test/dummy/test/models/person_test.rb
549
+ - test/dummy/test/models/group_person_test.rb
550
+ - test/dummy/test/models/group_test.rb
533
551
  - test/dummy/tmp/cache/assets/sprockets/v3.0/-_/-_GyWOMxsUj1Vcwf_522X6jS5CyLaFUziq4bW17lZAw.cache
534
552
  - test/dummy/tmp/cache/assets/sprockets/v3.0/-E/-E7l5lmqv4YBdAJz55GQp5nq67ZkFAo6Bi5OjNk5wH0.cache
535
553
  - test/dummy/tmp/cache/assets/sprockets/v3.0/-G/-GztuOFiffIyLHRd9L2OrRr8LvduErePFmti2KiEWnM.cache
@@ -1,4 +0,0 @@
1
- class Relationship < ActiveRecord::Base
2
- belongs_to :from, autosave: true, class_name: Person.name, foreign_key: 'person_from'
3
- belongs_to :to, autosave: true, class_name: Person.name, foreign_key: 'person_to'
4
- end
@@ -1,12 +0,0 @@
1
- class CreateJobs < ActiveRecord::Migration
2
- def change
3
- create_table :relationships do |t|
4
- t.string :name
5
- t.references :person_from
6
- t.references :person_to
7
- t.timestamps null: false
8
-
9
- t.index [:person_from, :person_to, :name], name: 'relationships_person_lookup'
10
- end
11
- end
12
- end