diff --git a/app/models/report.rb b/app/models/report.rb index da763b1..2f1eb24 100755 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -25,7 +25,7 @@ class Report < ApplicationRecord validates :validate_sushi, sushi: {presence: true} attr_readonly :created_by, :month, :year, :client_id - serialize :exceptions, Array + # serialize :exceptions, Array before_create :set_id before_validation :set_uid, on: :create after_save :push_report diff --git a/app/serializers/report_serializer.rb b/app/serializers/report_serializer.rb index 8a22fc9..7c515a1 100644 --- a/app/serializers/report_serializer.rb +++ b/app/serializers/report_serializer.rb @@ -16,7 +16,8 @@ def report_header :created => object.created, :reporting_period => object.reporting_period, :report_filters=> object.report_filters, - :report_attributes => object.report_attributes + :report_attributes => object.report_attributes, + :exceptions => object.exceptions, } end end diff --git a/db/migrate/20181017150207_change_exceptions_to_be_json_in_reports.rb b/db/migrate/20181017150207_change_exceptions_to_be_json_in_reports.rb new file mode 100644 index 0000000..2380008 --- /dev/null +++ b/db/migrate/20181017150207_change_exceptions_to_be_json_in_reports.rb @@ -0,0 +1,5 @@ +class ChangeExceptionsToBeJsonInReports < ActiveRecord::Migration[5.1] + def change + change_column :reports, :exceptions, :json + end +end diff --git a/db/schema.rb b/db/schema.rb index ca08d9f..876018e 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: 20180522095206) do +ActiveRecord::Schema.define(version: 20181017150207) do create_table "error_models", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "code" @@ -50,7 +50,7 @@ t.json "report_filters" t.json "report_attributes" t.json "report_datasets" - t.string "exceptions" + t.json "exceptions" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "year"