Skip to content
Snippets Groups Projects
Commit 2cb8a1c3 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Merge branch 'master' into fix_learning_object_serializer

parents a78c27de c818094c
No related branches found
No related tags found
1 merge request!310Fix learning object serializer
......@@ -30,7 +30,7 @@ class V1::ComplaintsController < ApplicationController
end
def complaint_params
params.require(:complaint).permit(:user_id, :description,:complaintable_id, :complaint_reason_id, :complaintable_type)
params.require(:complaint).permit(:user_id, :description,:complainable_id, :complaint_reason_id, :complainable_type)
end
end
......@@ -5,8 +5,8 @@
# id :integer not null, primary key
# description :text
# user_id :integer
# complaintable_id :integer
# complaintable_type :string
# complainable_id :integer
# complainable_type :string
# complaint_reason_id :integer
# created_at :datetime not null
# updated_at :datetime not null
......@@ -18,10 +18,10 @@ class Complaint < ApplicationRecord
belongs_to :complaint_reason
belongs_to :user
belongs_to :complaintable, polymorphic: true
belongs_to :complainable, polymorphic: true
validates_presence_of :user, :complaintable, :description, :complaint_reason
validates :user_id, uniqueness: { scope: [:complaintable_id, :complaintable_type] }
validates_presence_of :user, :complainable, :description, :complaint_reason
validates :user_id, uniqueness: { scope: [:complainable_id, :complainable_type] }
acts_as_paranoid
has_paper_trail
......
......@@ -2,7 +2,7 @@ module Complainable
extend ActiveSupport::Concern
included do
has_many :complaints, as: :complaintable
has_many :complaints, as: :complainable
end
end
class ChangeComplaintsColumnsNames < ActiveRecord::Migration[5.0]
def change
rename_column :complaints, :complaintable_id, :complainable_id
rename_column :complaints, :complaintable_type, :complainable_type
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment