Merge pull request #1443 from tchak/cleanup-after-migration
Remove all references to old STI
This commit is contained in:
commit
d4c62f5614
5 changed files with 13 additions and 17 deletions
|
@ -1,2 +0,0 @@
|
|||
class TypeDeChampPrivateDecorator < TypeDeChampDecorator
|
||||
end
|
|
@ -13,8 +13,8 @@ class Champ < ApplicationRecord
|
|||
before_save :multiple_select_to_string, if: Proc.new { type_champ == 'multiple_drop_down_list' }
|
||||
|
||||
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
||||
scope :public_only, -> { where(type: 'ChampPublic').or(where(private: false)) }
|
||||
scope :private_only, -> { where(type: 'ChampPrivate').or(where(private: true)) }
|
||||
scope :public_only, -> { where(private: false) }
|
||||
scope :private_only, -> { where(private: true) }
|
||||
|
||||
PIECE_JUSTIFICATIVE_FILE_MAX_SIZE = 200.megabytes
|
||||
|
||||
|
@ -37,10 +37,6 @@ class Champ < ApplicationRecord
|
|||
!private?
|
||||
end
|
||||
|
||||
def private?
|
||||
super || type == 'ChampPrivate'
|
||||
end
|
||||
|
||||
def same_hour? num
|
||||
same_date? num, '%H'
|
||||
end
|
||||
|
|
|
@ -27,8 +27,8 @@ class TypeDeChamp < ApplicationRecord
|
|||
|
||||
belongs_to :procedure
|
||||
|
||||
scope :public_only, -> { where(type: 'TypeDeChampPublic').or(where(private: false)) }
|
||||
scope :private_only, -> { where(type: 'TypeDeChampPrivate').or(where(private: true)) }
|
||||
scope :public_only, -> { where(private: false) }
|
||||
scope :private_only, -> { where(private: true) }
|
||||
|
||||
has_many :champ, inverse_of: :type_de_champ, dependent: :destroy do
|
||||
def build(params = {})
|
||||
|
@ -71,10 +71,6 @@ class TypeDeChamp < ApplicationRecord
|
|||
type_champ.in?(['header_section', 'explication'])
|
||||
end
|
||||
|
||||
def private?
|
||||
super || type == 'TypeDeChampPrivate'
|
||||
end
|
||||
|
||||
def public?
|
||||
!private?
|
||||
end
|
||||
|
|
6
db/migrate/20180308110811_add_defaults_to_champs.rb
Normal file
6
db/migrate/20180308110811_add_defaults_to_champs.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddDefaultsToChamps < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
change_column :champs, :private, :boolean, default: false, null: false
|
||||
change_column :types_de_champ, :private, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2018_03_07_101545) do
|
||||
ActiveRecord::Schema.define(version: 2018_03_08_110811) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -160,7 +160,7 @@ ActiveRecord::Schema.define(version: 2018_03_07_101545) do
|
|||
t.string "type"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "private"
|
||||
t.boolean "private", default: false, null: false
|
||||
t.integer "etablissement_id"
|
||||
t.index ["dossier_id"], name: "index_champs_on_dossier_id"
|
||||
t.index ["private"], name: "index_champs_on_private"
|
||||
|
@ -468,7 +468,7 @@ ActiveRecord::Schema.define(version: 2018_03_07_101545) do
|
|||
t.text "description"
|
||||
t.boolean "mandatory", default: false
|
||||
t.string "type"
|
||||
t.boolean "private"
|
||||
t.boolean "private", default: false, null: false
|
||||
t.index ["private"], name: "index_types_de_champ_on_private"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue