Create new model Avis
This commit is contained in:
parent
3e0977d56f
commit
72494de76f
6 changed files with 34 additions and 1 deletions
4
app/models/avis.rb
Normal file
4
app/models/avis.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class Avis < ApplicationRecord
|
||||
belongs_to :dossier
|
||||
belongs_to :gestionnaire
|
||||
end
|
|
@ -25,6 +25,7 @@ class Dossier < ActiveRecord::Base
|
|||
has_many :invites_gestionnaires, class_name: 'InviteGestionnaire', dependent: :destroy
|
||||
has_many :follows
|
||||
has_many :notifications, dependent: :destroy
|
||||
has_many :avis, dependent: :destroy
|
||||
|
||||
belongs_to :procedure
|
||||
belongs_to :user
|
||||
|
|
|
@ -12,6 +12,7 @@ class Gestionnaire < ActiveRecord::Base
|
|||
has_many :followed_dossiers, through: :follows, source: :dossier
|
||||
has_many :follows
|
||||
has_many :preference_list_dossiers
|
||||
has_many :avis
|
||||
|
||||
after_create :build_default_preferences_list_dossier
|
||||
after_create :build_default_preferences_smart_listing_page
|
||||
|
|
|
@ -15,6 +15,7 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|||
inflect.irregular 'type_de_champ', 'types_de_champ'
|
||||
inflect.irregular 'type_de_champ_private', 'types_de_champ_private'
|
||||
inflect.irregular 'assign_to', 'assign_tos'
|
||||
inflect.irregular('avis', 'avis')
|
||||
end
|
||||
|
||||
# These inflection rules are supported but not enabled by default:
|
||||
|
@ -24,4 +25,5 @@ end
|
|||
ActiveSupport::Inflector.inflections(:fr) do |inflect|
|
||||
inflect.plural(/$/, 's')
|
||||
inflect.plural(/(hib|ch|bij|caill|p|gen|jouj)ou$/i, '\1oux')
|
||||
inflect.irregular('avis', 'avis')
|
||||
end
|
||||
|
|
13
db/migrate/20170425100757_create_avis.rb
Normal file
13
db/migrate/20170425100757_create_avis.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class CreateAvis < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :avis do |t|
|
||||
t.string :email
|
||||
t.text :introduction
|
||||
t.text :answer
|
||||
t.references :gestionnaire
|
||||
t.references :dossier
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170523081220) do
|
||||
ActiveRecord::Schema.define(version: 20170425100757) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -71,6 +71,18 @@ ActiveRecord::Schema.define(version: 20170523081220) do
|
|||
t.index ["procedure_id"], name: "index_assign_tos_on_procedure_id", using: :btree
|
||||
end
|
||||
|
||||
create_table "avis", force: :cascade do |t|
|
||||
t.string "email"
|
||||
t.text "introduction"
|
||||
t.text "answer"
|
||||
t.integer "gestionnaire_id"
|
||||
t.integer "dossier_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["dossier_id"], name: "index_avis_on_dossier_id", using: :btree
|
||||
t.index ["gestionnaire_id"], name: "index_avis_on_gestionnaire_id", using: :btree
|
||||
end
|
||||
|
||||
create_table "cadastres", force: :cascade do |t|
|
||||
t.string "surface_intersection"
|
||||
t.float "surface_parcelle"
|
||||
|
|
Loading…
Add table
Reference in a new issue