Fix with migration bad table value for nil table attr
This commit is contained in:
parent
b3d454a53b
commit
5ff37a270e
6 changed files with 16 additions and 7 deletions
|
@ -8,7 +8,7 @@ class Backoffice::PreferenceListDossierController < ApplicationController
|
|||
def add
|
||||
PreferenceListDossier.create(
|
||||
libelle: params[:libelle],
|
||||
table: params[:table],
|
||||
table: (params[:table].empty? ? nil : params[:table]),
|
||||
attr: params[:attr],
|
||||
attr_decorate: params[:attr_decorate],
|
||||
bootstrap_lg: params[:bootstrap_lg],
|
||||
|
|
|
@ -76,7 +76,7 @@ class DossiersListGestionnaireService
|
|||
|
||||
@current_devise_profil.preference_list_dossiers
|
||||
.find_by(table: table, attr: attr, procedure: @procedure)
|
||||
.update_column :order, order
|
||||
.update order: order
|
||||
end
|
||||
|
||||
def reset_sort!
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class ChangeEmptytoNilInPreferenceListDossierTable < ActiveRecord::Migration
|
||||
class PreferenceListDossier < ActiveRecord::Base
|
||||
|
||||
end
|
||||
|
||||
def change
|
||||
PreferenceListDossier.where(table: '').update_all table: nil
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160926160051) do
|
||||
ActiveRecord::Schema.define(version: 20160927154248) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
|
@ -12,13 +12,13 @@ describe DossiersListFacades do
|
|||
|
||||
create :preference_list_dossier,
|
||||
gestionnaire: gestionnaire,
|
||||
table: '',
|
||||
table: nil,
|
||||
attr: 'state',
|
||||
attr_decorate: 'display_state'
|
||||
|
||||
create :preference_list_dossier,
|
||||
gestionnaire: gestionnaire,
|
||||
table: '',
|
||||
table: nil,
|
||||
attr: 'state',
|
||||
attr_decorate: 'display_state',
|
||||
procedure_id: procedure.id
|
||||
|
|
|
@ -28,7 +28,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
|
||||
create :preference_list_dossier,
|
||||
gestionnaire: gestionnaire,
|
||||
table: '',
|
||||
table: nil,
|
||||
attr: 'state',
|
||||
attr_decorate: 'display_state'
|
||||
|
||||
|
@ -46,7 +46,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
|
||||
create :preference_list_dossier,
|
||||
gestionnaire: gestionnaire,
|
||||
table: '',
|
||||
table: nil,
|
||||
attr: 'last_update',
|
||||
attr_decorate: 'last_update'
|
||||
|
||||
|
|
Loading…
Reference in a new issue