created the step_validation and step_verfication models

jamesperet %!s(int64=10) %!d(string=hace) años
padre
commit
fe5fd5904d

+ 4 - 0
app/models/step_validation.rb

@@ -0,0 +1,4 @@
1
+class StepValidation < ActiveRecord::Base
2
+  belongs_to :agent_step
3
+  has_many :step_verifications
4
+end

+ 4 - 0
app/models/step_verification.rb

@@ -0,0 +1,4 @@
1
+class StepVerification < ActiveRecord::Base
2
+  belongs_to :step_validation
3
+  belongs_to :validated_by, :class_name => "User"
4
+end

+ 12 - 0
db/migrate/20150121035550_create_step_validations.rb

@@ -0,0 +1,12 @@
1
+class CreateStepValidations < ActiveRecord::Migration
2
+  def change
3
+    create_table :step_validations do |t|
4
+      t.references :agent_step, index: true
5
+      t.references :step_verifications, index: true
6
+      t.string :mode
7
+      t.string :description
8
+
9
+      t.timestamps
10
+    end
11
+  end
12
+end

+ 12 - 0
db/migrate/20150121035726_create_step_verifications.rb

@@ -0,0 +1,12 @@
1
+class CreateStepVerifications < ActiveRecord::Migration
2
+  def change
3
+    create_table :step_verifications do |t|
4
+      t.references :step_validation, index: true
5
+      t.boolean :validated
6
+      t.references :validated_by, index: true
7
+      t.string :content
8
+
9
+      t.timestamps
10
+    end
11
+  end
12
+end

+ 25 - 1
db/schema.rb

@@ -11,7 +11,7 @@
11 11
 #
12 12
 # It's strongly recommended that you check this file into your version control system.
13 13
 
14
-ActiveRecord::Schema.define(version: 20150121034640) do
14
+ActiveRecord::Schema.define(version: 20150121035726) do
15 15
 
16 16
   # These are extensions that must be enabled in order to support this database
17 17
   enable_extension "plpgsql"
@@ -123,6 +123,30 @@ ActiveRecord::Schema.define(version: 20150121034640) do
123 123
   add_index "missions", ["mission_agents_id"], name: "index_missions_on_mission_agents_id", using: :btree
124 124
   add_index "missions", ["owner_id"], name: "index_missions_on_owner_id", using: :btree
125 125
 
126
+  create_table "step_validations", force: true do |t|
127
+    t.integer  "agent_step_id"
128
+    t.integer  "step_verifications_id"
129
+    t.string   "mode"
130
+    t.string   "description"
131
+    t.datetime "created_at"
132
+    t.datetime "updated_at"
133
+  end
134
+
135
+  add_index "step_validations", ["agent_step_id"], name: "index_step_validations_on_agent_step_id", using: :btree
136
+  add_index "step_validations", ["step_verifications_id"], name: "index_step_validations_on_step_verifications_id", using: :btree
137
+
138
+  create_table "step_verifications", force: true do |t|
139
+    t.integer  "step_validation_id"
140
+    t.boolean  "validated"
141
+    t.integer  "validated_by_id"
142
+    t.string   "content"
143
+    t.datetime "created_at"
144
+    t.datetime "updated_at"
145
+  end
146
+
147
+  add_index "step_verifications", ["step_validation_id"], name: "index_step_verifications_on_step_validation_id", using: :btree
148
+  add_index "step_verifications", ["validated_by_id"], name: "index_step_verifications_on_validated_by_id", using: :btree
149
+
126 150
   create_table "subscriptions", force: true do |t|
127 151
     t.string   "first_name"
128 152
     t.string   "last_name"

+ 13 - 0
test/fixtures/step_validations.yml

@@ -0,0 +1,13 @@
1
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+one:
4
+  agent_step: 
5
+  step_verifications_id: 
6
+  mode: MyString
7
+  description: MyString
8
+
9
+two:
10
+  agent_step: 
11
+  step_verifications_id: 
12
+  mode: MyString
13
+  description: MyString

+ 13 - 0
test/fixtures/step_verifications.yml

@@ -0,0 +1,13 @@
1
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+one:
4
+  step_validation_id: 
5
+  validated: false
6
+  validated_by_id: 
7
+  content: MyString
8
+
9
+two:
10
+  step_validation_id: 
11
+  validated: false
12
+  validated_by_id: 
13
+  content: MyString

+ 7 - 0
test/models/step_validation_test.rb

@@ -0,0 +1,7 @@
1
+require 'test_helper'
2
+
3
+class StepValidationTest < ActiveSupport::TestCase
4
+  # test "the truth" do
5
+  #   assert true
6
+  # end
7
+end

+ 7 - 0
test/models/step_verification_test.rb

@@ -0,0 +1,7 @@
1
+require 'test_helper'
2
+
3
+class StepVerificationTest < ActiveSupport::TestCase
4
+  # test "the truth" do
5
+  #   assert true
6
+  # end
7
+end