Added the priciples, sub principles and the groups.
This commit is contained in:
parent
0fa0f5f42e
commit
dc739cc189
3
app/models/subprinciple.rb
Normal file
3
app/models/subprinciple.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class Subprinciple < ApplicationRecord
|
||||||
|
belongs_to :principle
|
||||||
|
end
|
||||||
3
app/models/subprincipleitem.rb
Normal file
3
app/models/subprincipleitem.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class Subprincipleitem < ApplicationRecord
|
||||||
|
belongs_to :subprincipleitemgroup
|
||||||
|
end
|
||||||
3
app/models/subprincipleitemgroup.rb
Normal file
3
app/models/subprincipleitemgroup.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class Subprincipleitemgroup < ApplicationRecord
|
||||||
|
belongs_to :subprinciple
|
||||||
|
end
|
||||||
@ -1,4 +0,0 @@
|
|||||||
class Principle < ActiveRecord::Migration[7.0]
|
|
||||||
def change
|
|
||||||
end
|
|
||||||
end
|
|
||||||
12
db/migrate/20220611190503_create_subprinciples.rb
Normal file
12
db/migrate/20220611190503_create_subprinciples.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class CreateSubprinciples < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :subprinciples do |t|
|
||||||
|
t.references :principle, null: false, foreign_key: true
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :subprinciples, :name
|
||||||
|
end
|
||||||
|
end
|
||||||
10
db/migrate/20220611192407_create_subprincipalitemgroups.rb
Normal file
10
db/migrate/20220611192407_create_subprincipalitemgroups.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class CreateSubprincipalitemgroups < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :subprincipleitemgroups do |t|
|
||||||
|
t.references :subprinciple, null: false, foreign_key: true
|
||||||
|
t.string :type
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
11
db/migrate/20220611194255_create_subprincipalitems.rb
Normal file
11
db/migrate/20220611194255_create_subprincipalitems.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
class CreateSubprincipalitems < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :subprinciplitems do |t|
|
||||||
|
t.references :subprincipleitemgroup, null: false, foreign_key: true
|
||||||
|
t.text :description
|
||||||
|
t.boolean :affirmative
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
32
db/schema.rb
generated
32
db/schema.rb
generated
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2022_06_11_183116) do
|
ActiveRecord::Schema[7.0].define(version: 2022_06_11_194255) do
|
||||||
create_table "action_text_rich_texts", charset: "latin1", force: :cascade do |t|
|
create_table "action_text_rich_texts", charset: "latin1", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.text "body", size: :long
|
t.text "body", size: :long
|
||||||
@ -81,6 +81,33 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_11_183116) do
|
|||||||
t.index ["name"], name: "index_principles_on_name"
|
t.index ["name"], name: "index_principles_on_name"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "subprincipleitemgroups", charset: "latin1", force: :cascade do |t|
|
||||||
|
t.bigint "subprinciple_id", null: false
|
||||||
|
t.string "type"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["subprinciple_id"], name: "index_subprincipleitemgroups_on_subprinciple_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "subprinciples", charset: "latin1", force: :cascade do |t|
|
||||||
|
t.bigint "principle_id", null: false
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["name"], name: "index_subprinciples_on_name"
|
||||||
|
t.index ["principle_id"], name: "index_subprinciples_on_principle_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "subprinciplitems", charset: "latin1", force: :cascade do |t|
|
||||||
|
t.bigint "subprincipleitemgroup_id", null: false
|
||||||
|
t.text "description"
|
||||||
|
t.boolean "affirmative"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["subprincipleitemgroup_id"], name: "index_subprinciplitems_on_subprincipleitemgroup_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "users", charset: "latin1", force: :cascade do |t|
|
create_table "users", charset: "latin1", force: :cascade do |t|
|
||||||
t.string "email", default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
t.string "encrypted_password", default: "", null: false
|
t.string "encrypted_password", default: "", null: false
|
||||||
@ -107,4 +134,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_11_183116) do
|
|||||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||||
add_foreign_key "cafs", "companies"
|
add_foreign_key "cafs", "companies"
|
||||||
add_foreign_key "principles", "cafs"
|
add_foreign_key "principles", "cafs"
|
||||||
|
add_foreign_key "subprincipleitemgroups", "subprinciples"
|
||||||
|
add_foreign_key "subprinciples", "principles"
|
||||||
|
add_foreign_key "subprinciplitems", "subprincipleitemgroups"
|
||||||
end
|
end
|
||||||
|
|||||||
9
test/fixtures/subprincipalitemgroups.yml
vendored
Normal file
9
test/fixtures/subprincipalitemgroups.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
subprinciple: one
|
||||||
|
type:
|
||||||
|
|
||||||
|
two:
|
||||||
|
subprinciple: two
|
||||||
|
type:
|
||||||
11
test/fixtures/subprincipalitems.yml
vendored
Normal file
11
test/fixtures/subprincipalitems.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
subprincipleitemgroup: one
|
||||||
|
description: MyText
|
||||||
|
affirmative: false
|
||||||
|
|
||||||
|
two:
|
||||||
|
subprincipleitemgroup: two
|
||||||
|
description: MyText
|
||||||
|
affirmative: false
|
||||||
11
test/fixtures/subprinciples.yml
vendored
Normal file
11
test/fixtures/subprinciples.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
principle: one
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
||||||
|
|
||||||
|
two:
|
||||||
|
principle: two
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
||||||
7
test/models/subprincipalitem_test.rb
Normal file
7
test/models/subprincipalitem_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class SubprincipalitemTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
7
test/models/subprincipalitemgroup_test.rb
Normal file
7
test/models/subprincipalitemgroup_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class SubprincipalitemgroupTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
7
test/models/subprinciple_test.rb
Normal file
7
test/models/subprinciple_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class SubprincipleTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user