diff --git a/app/models/societe.rb b/app/models/societe.rb index 30b366f..6d63261 100644 --- a/app/models/societe.rb +++ b/app/models/societe.rb @@ -92,6 +92,16 @@ class Societe < ApplicationRecord end + def self.update_card_names + Societe.all.each do |s| + + + VContact.where(:codeproprietaire => s.socmanaginn).update_all(:cc_centre => s.nom) + + + end + end + diff --git a/db/migrate/20201030113001_add_cc_centre_to_v_contacts.rb b/db/migrate/20201030113001_add_cc_centre_to_v_contacts.rb new file mode 100644 index 0000000..4535a51 --- /dev/null +++ b/db/migrate/20201030113001_add_cc_centre_to_v_contacts.rb @@ -0,0 +1,5 @@ +class AddCcCentreToVContacts < ActiveRecord::Migration[6.0] + def change + add_column :v_contacts, :cc_centre, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 085da96..eea88fb 100644 --- a/db/schema.rb +++ b/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: 2019_11_03_133826) do +ActiveRecord::Schema.define(version: 2020_10_30_113001) do create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "name" @@ -2133,6 +2133,7 @@ ActiveRecord::Schema.define(version: 2019_11_03_133826) do t.decimal "ac_rate", precision: 14, scale: 2 t.boolean "enabled", default: false t.integer "nbr_mvt" + t.string "cc_centre" end create_table "video_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|