add roles to admin panel
This commit is contained in:
3
app/admin/roles.rb
Normal file
3
app/admin/roles.rb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
ActiveAdmin.register Role do
|
||||||
|
permit_params :name
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
ActiveAdmin.register User do
|
ActiveAdmin.register User do
|
||||||
permit_params :email, :name
|
permit_params :email, :name, role_ids: []
|
||||||
|
|
||||||
index do
|
index do
|
||||||
selectable_column
|
selectable_column
|
||||||
@@ -17,7 +17,8 @@ ActiveAdmin.register User do
|
|||||||
form do |f|
|
form do |f|
|
||||||
f.inputs do
|
f.inputs do
|
||||||
f.input :email
|
f.input :email
|
||||||
f.input :email
|
f.input :name
|
||||||
|
f.input :roles, as: :check_boxes
|
||||||
end
|
end
|
||||||
f.actions
|
f.actions
|
||||||
end
|
end
|
||||||
|
|||||||
18
app/models/role.rb
Normal file
18
app/models/role.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: roles
|
||||||
|
#
|
||||||
|
# id :bigint not null, primary key
|
||||||
|
# name :string
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_roles_on_name (name) UNIQUE
|
||||||
|
#
|
||||||
|
class Role < ApplicationRecord
|
||||||
|
has_and_belongs_to_many :users
|
||||||
|
|
||||||
|
validates :name, presence: true, uniqueness: true
|
||||||
|
end
|
||||||
@@ -26,5 +26,7 @@ class User < ApplicationRecord
|
|||||||
:omniauthable,
|
:omniauthable,
|
||||||
omniauth_providers: [:google_oauth2]
|
omniauth_providers: [:google_oauth2]
|
||||||
|
|
||||||
|
has_and_belongs_to_many :roles
|
||||||
|
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
end
|
end
|
||||||
|
|||||||
11
db/migrate/20220721133408_create_roles.rb
Normal file
11
db/migrate/20220721133408_create_roles.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
class CreateRoles < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :roles do |t|
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index(:roles, :name, unique: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
8
db/migrate/20220721133421_create_join_table_user_role.rb
Normal file
8
db/migrate/20220721133421_create_join_table_user_role.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class CreateJoinTableUserRole < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_join_table(:users, :roles, unique: true) do |t|
|
||||||
|
t.index(%i[user_id role_id])
|
||||||
|
t.index(%i[role_id user_id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
16
db/schema.rb
generated
16
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_07_21_132939) do
|
ActiveRecord::Schema[7.0].define(version: 2022_07_21_133421) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
@@ -118,6 +118,20 @@ ActiveRecord::Schema[7.0].define(version: 2022_07_21_132939) do
|
|||||||
t.index ["user_id"], name: "index_review_requests_on_user_id"
|
t.index ["user_id"], name: "index_review_requests_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "roles", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["name"], name: "index_roles_on_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "roles_users", id: false, force: :cascade do |t|
|
||||||
|
t.bigint "user_id", null: false
|
||||||
|
t.bigint "role_id", null: false
|
||||||
|
t.index ["role_id", "user_id"], name: "index_roles_users_on_role_id_and_user_id"
|
||||||
|
t.index ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "subjects", force: :cascade do |t|
|
create_table "subjects", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.bigint "category_id", null: false
|
t.bigint "category_id", null: false
|
||||||
|
|||||||
210
erd.svg
210
erd.svg
@@ -4,12 +4,12 @@
|
|||||||
<!-- Generated by graphviz version 4.0.0 (0)
|
<!-- Generated by graphviz version 4.0.0 (0)
|
||||||
-->
|
-->
|
||||||
<!-- Title: ProgressTest Pages: 1 -->
|
<!-- Title: ProgressTest Pages: 1 -->
|
||||||
<svg width="1052pt" height="691pt"
|
<svg width="965pt" height="691pt"
|
||||||
viewBox="0.00 0.00 1051.60 690.60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
viewBox="0.00 0.00 965.10 690.60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(28.8 661.8)">
|
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(28.8 661.8)">
|
||||||
<title>ProgressTest</title>
|
<title>ProgressTest</title>
|
||||||
<polygon fill="white" stroke="transparent" points="-28.8,28.8 -28.8,-661.8 1022.8,-661.8 1022.8,28.8 -28.8,28.8"/>
|
<polygon fill="white" stroke="transparent" points="-28.8,28.8 -28.8,-661.8 936.3,-661.8 936.3,28.8 -28.8,28.8"/>
|
||||||
<text text-anchor="middle" x="497" y="-618.6" font-family="Arial Bold" font-size="13.00">Progress Test - Models</text>
|
<text text-anchor="middle" x="453.75" y="-618.6" font-family="Arial Bold" font-size="13.00">Progress Test - Models</text>
|
||||||
<!-- m_ActiveAdmin::Comment -->
|
<!-- m_ActiveAdmin::Comment -->
|
||||||
<g id="node1" class="node">
|
<g id="node1" class="node">
|
||||||
<title>m_ActiveAdmin::Comment</title>
|
<title>m_ActiveAdmin::Comment</title>
|
||||||
@@ -94,41 +94,41 @@
|
|||||||
<!-- m_Axis -->
|
<!-- m_Axis -->
|
||||||
<g id="node5" class="node">
|
<g id="node5" class="node">
|
||||||
<title>m_Axis</title>
|
<title>m_Axis</title>
|
||||||
<path fill="none" stroke="black" d="M689,-520C689,-520 809,-520 809,-520 815,-520 821,-526 821,-532 821,-532 821,-551 821,-551 821,-557 815,-563 809,-563 809,-563 689,-563 689,-563 683,-563 677,-557 677,-551 677,-551 677,-532 677,-532 677,-526 683,-520 689,-520"/>
|
<path fill="none" stroke="black" d="M572,-520C572,-520 692,-520 692,-520 698,-520 704,-526 704,-532 704,-532 704,-551 704,-551 704,-557 698,-563 692,-563 692,-563 572,-563 572,-563 566,-563 560,-557 560,-551 560,-551 560,-532 560,-532 560,-526 566,-520 572,-520"/>
|
||||||
<text text-anchor="start" x="735" y="-550.2" font-family="Arial Bold" font-size="11.00">Axis</text>
|
<text text-anchor="start" x="618" y="-550.2" font-family="Arial Bold" font-size="11.00">Axis</text>
|
||||||
<polyline fill="none" stroke="black" points="677,-543 821,-543 "/>
|
<polyline fill="none" stroke="black" points="560,-543 704,-543 "/>
|
||||||
<text text-anchor="start" x="684" y="-529.5" font-family="Arial" font-size="10.00">name </text>
|
<text text-anchor="start" x="567" y="-529.5" font-family="Arial" font-size="10.00">name </text>
|
||||||
<text text-anchor="start" x="712" y="-529.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
<text text-anchor="start" x="595" y="-529.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_Subject -->
|
<!-- m_Subject -->
|
||||||
<g id="node11" class="node">
|
<g id="node12" class="node">
|
||||||
<title>m_Subject</title>
|
<title>m_Subject</title>
|
||||||
<path fill="none" stroke="black" d="M776,-368.5C776,-368.5 896,-368.5 896,-368.5 902,-368.5 908,-374.5 908,-380.5 908,-380.5 908,-399.5 908,-399.5 908,-405.5 902,-411.5 896,-411.5 896,-411.5 776,-411.5 776,-411.5 770,-411.5 764,-405.5 764,-399.5 764,-399.5 764,-380.5 764,-380.5 764,-374.5 770,-368.5 776,-368.5"/>
|
<path fill="none" stroke="black" d="M561,-368.5C561,-368.5 681,-368.5 681,-368.5 687,-368.5 693,-374.5 693,-380.5 693,-380.5 693,-399.5 693,-399.5 693,-405.5 687,-411.5 681,-411.5 681,-411.5 561,-411.5 561,-411.5 555,-411.5 549,-405.5 549,-399.5 549,-399.5 549,-380.5 549,-380.5 549,-374.5 555,-368.5 561,-368.5"/>
|
||||||
<text text-anchor="start" x="814" y="-398.7" font-family="Arial Bold" font-size="11.00">Subject</text>
|
<text text-anchor="start" x="599" y="-398.7" font-family="Arial Bold" font-size="11.00">Subject</text>
|
||||||
<polyline fill="none" stroke="black" points="764,-391.5 908,-391.5 "/>
|
<polyline fill="none" stroke="black" points="549,-391.5 693,-391.5 "/>
|
||||||
<text text-anchor="start" x="771" y="-378" font-family="Arial" font-size="10.00">name </text>
|
<text text-anchor="start" x="556" y="-378" font-family="Arial" font-size="10.00">name </text>
|
||||||
<text text-anchor="start" x="799" y="-378" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
<text text-anchor="start" x="584" y="-378" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_Axis->m_Subject -->
|
<!-- m_Axis->m_Subject -->
|
||||||
<g id="edge15" class="edge">
|
<g id="edge15" class="edge">
|
||||||
<title>m_Axis->m_Subject</title>
|
<title>m_Axis->m_Subject</title>
|
||||||
<path fill="none" stroke="black" d="M761.1,-519.71C776.29,-493.6 802.43,-448.69 819.46,-419.42"/>
|
<path fill="none" stroke="black" d="M630.47,-519.71C628.58,-494.05 625.36,-450.22 623.2,-420.94"/>
|
||||||
<polygon fill="black" stroke="black" points="822.2,-420.97 824.01,-411.61 816.76,-417.81 822.2,-420.97"/>
|
<polygon fill="black" stroke="black" points="626.32,-420.36 622.52,-411.61 620.04,-420.82 626.32,-420.36"/>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_Category -->
|
<!-- m_Category -->
|
||||||
<g id="node6" class="node">
|
<g id="node6" class="node">
|
||||||
<title>m_Category</title>
|
<title>m_Category</title>
|
||||||
<path fill="none" stroke="black" d="M862,-520C862,-520 982,-520 982,-520 988,-520 994,-526 994,-532 994,-532 994,-551 994,-551 994,-557 988,-563 982,-563 982,-563 862,-563 862,-563 856,-563 850,-557 850,-551 850,-551 850,-532 850,-532 850,-526 856,-520 862,-520"/>
|
<path fill="none" stroke="black" d="M399,-520C399,-520 519,-520 519,-520 525,-520 531,-526 531,-532 531,-532 531,-551 531,-551 531,-557 525,-563 519,-563 519,-563 399,-563 399,-563 393,-563 387,-557 387,-551 387,-551 387,-532 387,-532 387,-526 393,-520 399,-520"/>
|
||||||
<text text-anchor="start" x="895.5" y="-550.2" font-family="Arial Bold" font-size="11.00">Category</text>
|
<text text-anchor="start" x="432.5" y="-550.2" font-family="Arial Bold" font-size="11.00">Category</text>
|
||||||
<polyline fill="none" stroke="black" points="850,-543 994,-543 "/>
|
<polyline fill="none" stroke="black" points="387,-543 531,-543 "/>
|
||||||
<text text-anchor="start" x="857" y="-529.5" font-family="Arial" font-size="10.00">name </text>
|
<text text-anchor="start" x="394" y="-529.5" font-family="Arial" font-size="10.00">name </text>
|
||||||
<text text-anchor="start" x="885" y="-529.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
<text text-anchor="start" x="422" y="-529.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_Category->m_Subject -->
|
<!-- m_Category->m_Subject -->
|
||||||
<g id="edge14" class="edge">
|
<g id="edge14" class="edge">
|
||||||
<title>m_Category->m_Subject</title>
|
<title>m_Category->m_Subject</title>
|
||||||
<path fill="none" stroke="black" d="M910.04,-519.71C895.02,-493.6 869.19,-448.69 852.35,-419.42"/>
|
<path fill="none" stroke="black" d="M481.53,-519.71C510.3,-493.16 560.15,-447.15 591.81,-417.94"/>
|
||||||
<polygon fill="black" stroke="black" points="855.07,-417.84 847.86,-411.61 849.61,-420.98 855.07,-417.84"/>
|
<polygon fill="black" stroke="black" points="594.19,-420.03 598.67,-411.61 589.92,-415.4 594.19,-420.03"/>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_CkEditorUpload -->
|
<!-- m_CkEditorUpload -->
|
||||||
<g id="node7" class="node">
|
<g id="node7" class="node">
|
||||||
@@ -144,111 +144,127 @@
|
|||||||
<!-- m_Question -->
|
<!-- m_Question -->
|
||||||
<g id="node8" class="node">
|
<g id="node8" class="node">
|
||||||
<title>m_Question</title>
|
<title>m_Question</title>
|
||||||
<path fill="none" stroke="black" d="M698,-93.5C698,-93.5 818,-93.5 818,-93.5 824,-93.5 830,-99.5 830,-105.5 830,-105.5 830,-280.5 830,-280.5 830,-286.5 824,-292.5 818,-292.5 818,-292.5 698,-292.5 698,-292.5 692,-292.5 686,-286.5 686,-280.5 686,-280.5 686,-105.5 686,-105.5 686,-99.5 692,-93.5 698,-93.5"/>
|
<path fill="none" stroke="black" d="M610,-93.5C610,-93.5 730,-93.5 730,-93.5 736,-93.5 742,-99.5 742,-105.5 742,-105.5 742,-280.5 742,-280.5 742,-286.5 736,-292.5 730,-292.5 730,-292.5 610,-292.5 610,-292.5 604,-292.5 598,-286.5 598,-280.5 598,-280.5 598,-105.5 598,-105.5 598,-99.5 604,-93.5 610,-93.5"/>
|
||||||
<text text-anchor="start" x="732" y="-279.7" font-family="Arial Bold" font-size="11.00">Question</text>
|
<text text-anchor="start" x="644" y="-279.7" font-family="Arial Bold" font-size="11.00">Question</text>
|
||||||
<polyline fill="none" stroke="black" points="686,-272.5 830,-272.5 "/>
|
<polyline fill="none" stroke="black" points="598,-272.5 742,-272.5 "/>
|
||||||
<text text-anchor="start" x="693" y="-259" font-family="Arial" font-size="10.00">alternatives </text>
|
<text text-anchor="start" x="605" y="-259" font-family="Arial" font-size="10.00">alternatives </text>
|
||||||
<text text-anchor="start" x="747" y="-259" font-family="Arial Italic" font-size="10.00" fill="#999999">jsonb ∗</text>
|
<text text-anchor="start" x="659" y="-259" font-family="Arial Italic" font-size="10.00" fill="#999999">jsonb ∗</text>
|
||||||
<text text-anchor="start" x="693" y="-246" font-family="Arial" font-size="10.00">authorship </text>
|
<text text-anchor="start" x="605" y="-246" font-family="Arial" font-size="10.00">authorship </text>
|
||||||
<text text-anchor="start" x="742" y="-246" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
<text text-anchor="start" x="654" y="-246" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
<text text-anchor="start" x="693" y="-233" font-family="Arial" font-size="10.00">authorship_year </text>
|
<text text-anchor="start" x="605" y="-233" font-family="Arial" font-size="10.00">authorship_year </text>
|
||||||
<text text-anchor="start" x="766" y="-233" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
<text text-anchor="start" x="678" y="-233" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
<text text-anchor="start" x="693" y="-220" font-family="Arial" font-size="10.00">bloom_taxonomy </text>
|
<text text-anchor="start" x="605" y="-220" font-family="Arial" font-size="10.00">bloom_taxonomy </text>
|
||||||
<text text-anchor="start" x="771" y="-220" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
<text text-anchor="start" x="683" y="-220" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
<text text-anchor="start" x="693" y="-207" font-family="Arial" font-size="10.00">body </text>
|
<text text-anchor="start" x="605" y="-207" font-family="Arial" font-size="10.00">body </text>
|
||||||
<text text-anchor="start" x="718" y="-207" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
<text text-anchor="start" x="630" y="-207" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
||||||
<text text-anchor="start" x="693" y="-194" font-family="Arial" font-size="10.00">check_type </text>
|
<text text-anchor="start" x="605" y="-194" font-family="Arial" font-size="10.00">check_type </text>
|
||||||
<text text-anchor="start" x="747" y="-194" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
<text text-anchor="start" x="659" y="-194" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
<text text-anchor="start" x="693" y="-181" font-family="Arial" font-size="10.00">difficulty </text>
|
<text text-anchor="start" x="605" y="-181" font-family="Arial" font-size="10.00">difficulty </text>
|
||||||
<text text-anchor="start" x="733" y="-181" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
<text text-anchor="start" x="645" y="-181" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
<text text-anchor="start" x="693" y="-168" font-family="Arial" font-size="10.00">explanation </text>
|
<text text-anchor="start" x="605" y="-168" font-family="Arial" font-size="10.00">explanation </text>
|
||||||
<text text-anchor="start" x="746" y="-168" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
<text text-anchor="start" x="658" y="-168" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
||||||
<text text-anchor="start" x="693" y="-155" font-family="Arial" font-size="10.00">instruction </text>
|
<text text-anchor="start" x="605" y="-155" font-family="Arial" font-size="10.00">instruction </text>
|
||||||
<text text-anchor="start" x="742" y="-155" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
<text text-anchor="start" x="654" y="-155" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
||||||
<text text-anchor="start" x="693" y="-142" font-family="Arial" font-size="10.00">intention </text>
|
<text text-anchor="start" x="605" y="-142" font-family="Arial" font-size="10.00">intention </text>
|
||||||
<text text-anchor="start" x="733" y="-142" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
<text text-anchor="start" x="645" y="-142" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
||||||
<text text-anchor="start" x="693" y="-129" font-family="Arial" font-size="10.00">references </text>
|
<text text-anchor="start" x="605" y="-129" font-family="Arial" font-size="10.00">references </text>
|
||||||
<text text-anchor="start" x="742" y="-129" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
<text text-anchor="start" x="654" y="-129" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
||||||
<text text-anchor="start" x="693" y="-116" font-family="Arial" font-size="10.00">status </text>
|
<text text-anchor="start" x="605" y="-116" font-family="Arial" font-size="10.00">status </text>
|
||||||
<text text-anchor="start" x="724" y="-116" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
<text text-anchor="start" x="636" y="-116" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
||||||
<text text-anchor="start" x="693" y="-103" font-family="Arial" font-size="10.00">support </text>
|
<text text-anchor="start" x="605" y="-103" font-family="Arial" font-size="10.00">support </text>
|
||||||
<text text-anchor="start" x="729" y="-103" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
<text text-anchor="start" x="641" y="-103" font-family="Arial Italic" font-size="10.00" fill="#999999">text</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_ReviewMessage -->
|
<!-- m_ReviewMessage -->
|
||||||
<g id="node9" class="node">
|
<g id="node9" class="node">
|
||||||
<title>m_ReviewMessage</title>
|
<title>m_ReviewMessage</title>
|
||||||
<path fill="none" stroke="black" d="M698,-0.5C698,-0.5 818,-0.5 818,-0.5 824,-0.5 830,-6.5 830,-12.5 830,-12.5 830,-44.5 830,-44.5 830,-50.5 824,-56.5 818,-56.5 818,-56.5 698,-56.5 698,-56.5 692,-56.5 686,-50.5 686,-44.5 686,-44.5 686,-12.5 686,-12.5 686,-6.5 692,-0.5 698,-0.5"/>
|
<path fill="none" stroke="black" d="M755,-0.5C755,-0.5 875,-0.5 875,-0.5 881,-0.5 887,-6.5 887,-12.5 887,-12.5 887,-44.5 887,-44.5 887,-50.5 881,-56.5 875,-56.5 875,-56.5 755,-56.5 755,-56.5 749,-56.5 743,-50.5 743,-44.5 743,-44.5 743,-12.5 743,-12.5 743,-6.5 749,-0.5 755,-0.5"/>
|
||||||
<text text-anchor="start" x="714" y="-43.7" font-family="Arial Bold" font-size="11.00">ReviewMessage</text>
|
<text text-anchor="start" x="771" y="-43.7" font-family="Arial Bold" font-size="11.00">ReviewMessage</text>
|
||||||
<polyline fill="none" stroke="black" points="686,-36.5 830,-36.5 "/>
|
<polyline fill="none" stroke="black" points="743,-36.5 887,-36.5 "/>
|
||||||
<text text-anchor="start" x="693" y="-23.5" font-family="Arial" font-size="10.00">content </text>
|
<text text-anchor="start" x="750" y="-23.5" font-family="Arial" font-size="10.00">content </text>
|
||||||
<text text-anchor="start" x="729" y="-23.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
<text text-anchor="start" x="786" y="-23.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
||||||
<text text-anchor="start" x="693" y="-10.5" font-family="Arial" font-size="10.00">feedback_type </text>
|
<text text-anchor="start" x="750" y="-10.5" font-family="Arial" font-size="10.00">feedback_type </text>
|
||||||
<text text-anchor="start" x="760" y="-10.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
<text text-anchor="start" x="817" y="-10.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_Question->m_ReviewMessage -->
|
<!-- m_Question->m_ReviewMessage -->
|
||||||
<g id="edge9" class="edge">
|
<g id="edge9" class="edge">
|
||||||
<title>m_Question->m_ReviewMessage</title>
|
<title>m_Question->m_ReviewMessage</title>
|
||||||
<path fill="none" stroke="black" d="M758,-93.26C758,-83.5 758,-74.1 758,-65.65"/>
|
<path fill="none" stroke="black" d="M742.08,-111.23C757.09,-94.4 772.12,-77.55 784.61,-63.56"/>
|
||||||
<polygon fill="black" stroke="black" points="761.15,-65.55 758,-56.55 754.85,-65.55 761.15,-65.55"/>
|
<polygon fill="black" stroke="black" points="787.25,-65.33 790.89,-56.52 782.55,-61.14 787.25,-65.33"/>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_ReviewRequest -->
|
<!-- m_ReviewRequest -->
|
||||||
<g id="node10" class="node">
|
<g id="node10" class="node">
|
||||||
<title>m_ReviewRequest</title>
|
<title>m_ReviewRequest</title>
|
||||||
<path fill="none" stroke="black" d="M525,-7C525,-7 645,-7 645,-7 651,-7 657,-13 657,-19 657,-19 657,-38 657,-38 657,-44 651,-50 645,-50 645,-50 525,-50 525,-50 519,-50 513,-44 513,-38 513,-38 513,-19 513,-19 513,-13 519,-7 525,-7"/>
|
<path fill="none" stroke="black" d="M582,-7C582,-7 702,-7 702,-7 708,-7 714,-13 714,-19 714,-19 714,-38 714,-38 714,-44 708,-50 702,-50 702,-50 582,-50 582,-50 576,-50 570,-44 570,-38 570,-38 570,-19 570,-19 570,-13 576,-7 582,-7"/>
|
||||||
<text text-anchor="start" x="542" y="-37.2" font-family="Arial Bold" font-size="11.00">ReviewRequest</text>
|
<text text-anchor="start" x="599" y="-37.2" font-family="Arial Bold" font-size="11.00">ReviewRequest</text>
|
||||||
<polyline fill="none" stroke="black" points="513,-30 657,-30 "/>
|
<polyline fill="none" stroke="black" points="570,-30 714,-30 "/>
|
||||||
<text text-anchor="start" x="520" y="-16.5" font-family="Arial" font-size="10.00">answered </text>
|
<text text-anchor="start" x="577" y="-16.5" font-family="Arial" font-size="10.00">answered </text>
|
||||||
<text text-anchor="start" x="566" y="-16.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
<text text-anchor="start" x="623" y="-16.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_Question->m_ReviewRequest -->
|
<!-- m_Question->m_ReviewRequest -->
|
||||||
<g id="edge7" class="edge">
|
<g id="edge7" class="edge">
|
||||||
<title>m_Question->m_ReviewRequest</title>
|
<title>m_Question->m_ReviewRequest</title>
|
||||||
<path fill="none" stroke="black" d="M685.85,-113.99C678.6,-106.77 671.24,-99.66 664,-93 650,-80.11 633.73,-66.78 619.61,-55.68"/>
|
<path fill="none" stroke="black" d="M652.99,-93.26C650.85,-80.87 648.81,-69.05 647.09,-59.03"/>
|
||||||
<polygon fill="black" stroke="black" points="621.47,-53.14 612.44,-50.09 617.6,-58.11 621.47,-53.14"/>
|
<polygon fill="black" stroke="black" points="650.17,-58.34 645.53,-50.01 643.96,-59.41 650.17,-58.34"/>
|
||||||
|
</g>
|
||||||
|
<!-- m_Role -->
|
||||||
|
<g id="node11" class="node">
|
||||||
|
<title>m_Role</title>
|
||||||
|
<path fill="none" stroke="black" d="M755,-520C755,-520 875,-520 875,-520 881,-520 887,-526 887,-532 887,-532 887,-551 887,-551 887,-557 881,-563 875,-563 875,-563 755,-563 755,-563 749,-563 743,-557 743,-551 743,-551 743,-532 743,-532 743,-526 749,-520 755,-520"/>
|
||||||
|
<text text-anchor="start" x="800.5" y="-550.2" font-family="Arial Bold" font-size="11.00">Role</text>
|
||||||
|
<polyline fill="none" stroke="black" points="743,-543 887,-543 "/>
|
||||||
|
<text text-anchor="start" x="750" y="-529.5" font-family="Arial" font-size="10.00">name </text>
|
||||||
|
<text text-anchor="start" x="778" y="-529.5" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
||||||
|
</g>
|
||||||
|
<!-- m_User -->
|
||||||
|
<g id="node13" class="node">
|
||||||
|
<title>m_User</title>
|
||||||
|
<path fill="none" stroke="black" d="M734.5,-336C734.5,-336 895.5,-336 895.5,-336 901.5,-336 907.5,-342 907.5,-348 907.5,-348 907.5,-432 907.5,-432 907.5,-438 901.5,-444 895.5,-444 895.5,-444 734.5,-444 734.5,-444 728.5,-444 722.5,-438 722.5,-432 722.5,-432 722.5,-348 722.5,-348 722.5,-342 728.5,-336 734.5,-336"/>
|
||||||
|
<text text-anchor="start" x="800.5" y="-431.2" font-family="Arial Bold" font-size="11.00">User</text>
|
||||||
|
<polyline fill="none" stroke="black" points="722.5,-424 907.5,-424 "/>
|
||||||
|
<text text-anchor="start" x="730" y="-411" font-family="Arial" font-size="10.00">email </text>
|
||||||
|
<text text-anchor="start" x="757" y="-411" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
||||||
|
<text text-anchor="start" x="730" y="-398" font-family="Arial" font-size="10.00">encrypted_password </text>
|
||||||
|
<text text-anchor="start" x="824" y="-398" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
||||||
|
<text text-anchor="start" x="730" y="-385" font-family="Arial" font-size="10.00">name </text>
|
||||||
|
<text text-anchor="start" x="758" y="-385" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
||||||
|
<text text-anchor="start" x="730" y="-372" font-family="Arial" font-size="10.00">remember_created_at </text>
|
||||||
|
<text text-anchor="start" x="828" y="-372" font-family="Arial Italic" font-size="10.00" fill="#999999">datetime (6,0)</text>
|
||||||
|
<text text-anchor="start" x="730" y="-359" font-family="Arial" font-size="10.00">reset_password_sent_at </text>
|
||||||
|
<text text-anchor="start" x="840" y="-359" font-family="Arial Italic" font-size="10.00" fill="#999999">datetime (6,0)</text>
|
||||||
|
<text text-anchor="start" x="730" y="-346" font-family="Arial" font-size="10.00">reset_password_token </text>
|
||||||
|
<text text-anchor="start" x="832" y="-346" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
||||||
|
</g>
|
||||||
|
<!-- m_Role->m_User -->
|
||||||
|
<g id="edge16" class="edge">
|
||||||
|
<title>m_Role->m_User</title>
|
||||||
|
<path fill="none" stroke="black" d="M815,-510.65C815,-494.16 815,-473.04 815,-453.14"/>
|
||||||
|
<polygon fill="black" stroke="black" points="811.85,-510.71 815,-519.71 818.15,-510.71 811.85,-510.71"/>
|
||||||
|
<polygon fill="black" stroke="black" points="818.15,-453.11 815,-444.11 811.85,-453.11 818.15,-453.11"/>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_Subject->m_Question -->
|
<!-- m_Subject->m_Question -->
|
||||||
<g id="edge12" class="edge">
|
<g id="edge12" class="edge">
|
||||||
<title>m_Subject->m_Question</title>
|
<title>m_Subject->m_Question</title>
|
||||||
<path fill="none" stroke="black" d="M827.65,-368.13C821.01,-351.54 811.18,-326.94 800.97,-301.43"/>
|
<path fill="none" stroke="black" d="M626.24,-368.13C630.4,-351.61 636.54,-327.15 642.92,-301.76"/>
|
||||||
<polygon fill="black" stroke="black" points="803.77,-299.94 797.5,-292.75 797.92,-302.28 803.77,-299.94"/>
|
<polygon fill="black" stroke="black" points="646.05,-302.25 645.19,-292.75 639.94,-300.71 646.05,-302.25"/>
|
||||||
</g>
|
|
||||||
<!-- m_User -->
|
|
||||||
<g id="node12" class="node">
|
|
||||||
<title>m_User</title>
|
|
||||||
<path fill="none" stroke="black" d="M561.5,-336C561.5,-336 722.5,-336 722.5,-336 728.5,-336 734.5,-342 734.5,-348 734.5,-348 734.5,-432 734.5,-432 734.5,-438 728.5,-444 722.5,-444 722.5,-444 561.5,-444 561.5,-444 555.5,-444 549.5,-438 549.5,-432 549.5,-432 549.5,-348 549.5,-348 549.5,-342 555.5,-336 561.5,-336"/>
|
|
||||||
<text text-anchor="start" x="627.5" y="-431.2" font-family="Arial Bold" font-size="11.00">User</text>
|
|
||||||
<polyline fill="none" stroke="black" points="549.5,-424 734.5,-424 "/>
|
|
||||||
<text text-anchor="start" x="557" y="-411" font-family="Arial" font-size="10.00">email </text>
|
|
||||||
<text text-anchor="start" x="584" y="-411" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗ U</text>
|
|
||||||
<text text-anchor="start" x="557" y="-398" font-family="Arial" font-size="10.00">encrypted_password </text>
|
|
||||||
<text text-anchor="start" x="651" y="-398" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
|
||||||
<text text-anchor="start" x="557" y="-385" font-family="Arial" font-size="10.00">name </text>
|
|
||||||
<text text-anchor="start" x="585" y="-385" font-family="Arial Italic" font-size="10.00" fill="#999999">string ∗</text>
|
|
||||||
<text text-anchor="start" x="557" y="-372" font-family="Arial" font-size="10.00">remember_created_at </text>
|
|
||||||
<text text-anchor="start" x="655" y="-372" font-family="Arial Italic" font-size="10.00" fill="#999999">datetime (6,0)</text>
|
|
||||||
<text text-anchor="start" x="557" y="-359" font-family="Arial" font-size="10.00">reset_password_sent_at </text>
|
|
||||||
<text text-anchor="start" x="667" y="-359" font-family="Arial Italic" font-size="10.00" fill="#999999">datetime (6,0)</text>
|
|
||||||
<text text-anchor="start" x="557" y="-346" font-family="Arial" font-size="10.00">reset_password_token </text>
|
|
||||||
<text text-anchor="start" x="659" y="-346" font-family="Arial Italic" font-size="10.00" fill="#999999">string</text>
|
|
||||||
</g>
|
</g>
|
||||||
<!-- m_User->m_Question -->
|
<!-- m_User->m_Question -->
|
||||||
<g id="edge11" class="edge">
|
<g id="edge11" class="edge">
|
||||||
<title>m_User->m_Question</title>
|
<title>m_User->m_Question</title>
|
||||||
<path fill="none" stroke="black" d="M673.54,-335.97C680.09,-324.96 687.22,-312.99 694.45,-300.82"/>
|
<path fill="none" stroke="black" d="M775.57,-335.97C766.8,-324.17 757.2,-311.27 747.48,-298.2"/>
|
||||||
<polygon fill="black" stroke="black" points="697.33,-302.15 699.22,-292.81 691.91,-298.93 697.33,-302.15"/>
|
<polygon fill="black" stroke="black" points="749.97,-296.27 742.08,-290.93 744.92,-300.03 749.97,-296.27"/>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_User->m_ReviewMessage -->
|
<!-- m_User->m_ReviewMessage -->
|
||||||
<g id="edge10" class="edge">
|
<g id="edge10" class="edge">
|
||||||
<title>m_User->m_ReviewMessage</title>
|
<title>m_User->m_ReviewMessage</title>
|
||||||
<path fill="none" stroke="black" d="M642,-192C646.07,-146.2 645.49,-130.56 672,-93 680.16,-81.43 691.1,-71.12 702.43,-62.34"/>
|
<path fill="none" stroke="black" d="M815,-192C804.57,-149.75 806.71,-99.41 810.06,-66.07"/>
|
||||||
<polygon fill="black" stroke="black" points="704.55,-64.69 709.91,-56.8 700.8,-59.63 704.55,-64.69"/>
|
<polygon fill="black" stroke="black" points="813.23,-66.01 811.07,-56.72 806.97,-65.33 813.23,-66.01"/>
|
||||||
</g>
|
</g>
|
||||||
<!-- m_User->m_ReviewRequest -->
|
<!-- m_User->m_ReviewRequest -->
|
||||||
<g id="edge8" class="edge">
|
<g id="edge8" class="edge">
|
||||||
<title>m_User->m_ReviewRequest</title>
|
<title>m_User->m_ReviewRequest</title>
|
||||||
<path fill="none" stroke="black" d="M639.47,-335.92C638.21,-296.64 637.74,-241.88 642,-194"/>
|
<path fill="none" stroke="black" d="M821.82,-335.62C825.25,-295.95 826.56,-240.84 815,-194"/>
|
||||||
<path fill="none" stroke="black" d="M642,-192C646.37,-142.93 621.5,-89.71 603.22,-58.01"/>
|
<path fill="none" stroke="black" d="M815,-192C802.78,-142.49 793.51,-128.6 757,-93 740.92,-77.33 720.21,-64.32 700.8,-54.24"/>
|
||||||
<polygon fill="black" stroke="black" points="605.8,-56.18 598.5,-50.04 600.38,-59.39 605.8,-56.18"/>
|
<polygon fill="black" stroke="black" points="702.03,-51.34 692.58,-50.11 699.2,-56.97 702.03,-51.34"/>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
18
spec/factories/roles.rb
Normal file
18
spec/factories/roles.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: roles
|
||||||
|
#
|
||||||
|
# id :bigint not null, primary key
|
||||||
|
# name :string
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_roles_on_name (name) UNIQUE
|
||||||
|
#
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :role do
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
18
spec/models/role_spec.rb
Normal file
18
spec/models/role_spec.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# == Schema Information
|
||||||
|
#
|
||||||
|
# Table name: roles
|
||||||
|
#
|
||||||
|
# id :bigint not null, primary key
|
||||||
|
# name :string
|
||||||
|
# created_at :datetime not null
|
||||||
|
# updated_at :datetime not null
|
||||||
|
#
|
||||||
|
# Indexes
|
||||||
|
#
|
||||||
|
# index_roles_on_name (name) UNIQUE
|
||||||
|
#
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Role, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user