Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
88934ca5
Commit
88934ca5
authored
8 years ago
by
Marcela Ribeiro de Oliveira
Browse files
Options
Downloads
Patches
Plain Diff
change columns complaintable_type and complaintable_id to complainable_type and complainable_id
parent
ce54d17f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/v1/complaints_controller.rb
+1
-1
1 addition, 1 deletion
app/controllers/v1/complaints_controller.rb
app/models/complaint.rb
+5
-5
5 additions, 5 deletions
app/models/complaint.rb
app/models/concerns/complainable.rb
+1
-1
1 addition, 1 deletion
app/models/concerns/complainable.rb
with
7 additions
and
7 deletions
app/controllers/v1/complaints_controller.rb
+
1
−
1
View file @
88934ca5
...
...
@@ -30,7 +30,7 @@ class V1::ComplaintsController < ApplicationController
end
def
complaint_params
params
.
require
(
:complaint
).
permit
(
:user_id
,
:description
,
:complain
t
able_id
,
:complaint_reason_id
,
:complain
t
able_type
)
params
.
require
(
:complaint
).
permit
(
:user_id
,
:description
,
:complainable_id
,
:complaint_reason_id
,
:complainable_type
)
end
end
This diff is collapsed.
Click to expand it.
app/models/complaint.rb
+
5
−
5
View file @
88934ca5
...
...
@@ -5,8 +5,8 @@
# id :integer not null, primary key
# description :text
# user_id :integer
# complain
t
able_id :integer
# complain
t
able_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
:complain
t
able
,
polymorphic:
true
belongs_to
:complainable
,
polymorphic:
true
validates_presence_of
:user
,
:complain
t
able
,
:description
,
:complaint_reason
validates
:user_id
,
uniqueness:
{
scope:
[
:complain
t
able_id
,
:complain
t
able_type
]
}
validates_presence_of
:user
,
:complainable
,
:description
,
:complaint_reason
validates
:user_id
,
uniqueness:
{
scope:
[
:complainable_id
,
:complainable_type
]
}
acts_as_paranoid
has_paper_trail
...
...
This diff is collapsed.
Click to expand it.
app/models/concerns/complainable.rb
+
1
−
1
View file @
88934ca5
...
...
@@ -2,7 +2,7 @@ module Complainable
extend
ActiveSupport
::
Concern
included
do
has_many
:complaints
,
as: :complain
t
able
has_many
:complaints
,
as: :complainable
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment