Add RNAInformation model
This commit is contained in:
parent
704e491cd0
commit
05298f7a40
6 changed files with 46 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
class Entreprise < ActiveRecord::Base
|
||||
belongs_to :dossier
|
||||
has_one :etablissement
|
||||
has_one :rna_information
|
||||
end
|
||||
|
|
3
app/models/rna_information.rb
Normal file
3
app/models/rna_information.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class RNAInformation < ActiveRecord::Base
|
||||
belongs_to :entreprise
|
||||
end
|
14
db/migrate/20151211093833_create_rna_information_table.rb
Normal file
14
db/migrate/20151211093833_create_rna_information_table.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class CreateRNAInformationTable < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :rna_informations do |t|
|
||||
t.string :association_id
|
||||
t.string :titre
|
||||
t.text :objet
|
||||
t.date :date_creation
|
||||
t.date :date_declaration
|
||||
t.date :date_publication
|
||||
end
|
||||
|
||||
add_reference :rna_informations, :entreprise, references: :entreprise
|
||||
end
|
||||
end
|
12
db/schema.rb
12
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151210150958) do
|
||||
ActiveRecord::Schema.define(version: 20151211093833) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -172,6 +172,16 @@ ActiveRecord::Schema.define(version: 20151210150958) do
|
|||
t.integer "dossier_id"
|
||||
end
|
||||
|
||||
create_table "rna_informations", force: :cascade do |t|
|
||||
t.string "association_id"
|
||||
t.string "titre"
|
||||
t.text "objet"
|
||||
t.date "date_creation"
|
||||
t.date "date_declaration"
|
||||
t.date "date_publication"
|
||||
t.integer "entreprise_id"
|
||||
end
|
||||
|
||||
create_table "types_de_champ", force: :cascade do |t|
|
||||
t.string "libelle"
|
||||
t.string "type_champ"
|
||||
|
|
|
@ -19,5 +19,6 @@ describe Entreprise do
|
|||
describe 'associations' do
|
||||
it { is_expected.to belong_to(:dossier) }
|
||||
it { is_expected.to have_one(:etablissement) }
|
||||
it { is_expected.to have_one(:rna_information) }
|
||||
end
|
||||
end
|
||||
|
|
16
spec/models/rna_information_spec.rb
Normal file
16
spec/models/rna_information_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe RNAInformation do
|
||||
describe 'databse columns' do
|
||||
it { is_expected.to have_db_column(:association_id) }
|
||||
it { is_expected.to have_db_column(:titre) }
|
||||
it { is_expected.to have_db_column(:objet) }
|
||||
it { is_expected.to have_db_column(:date_creation) }
|
||||
it { is_expected.to have_db_column(:date_publication) }
|
||||
it { is_expected.to have_db_column(:date_declaration) }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
it { is_expected.to belong_to(:entreprise) }
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue