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
Harbor 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
2e708e2f
Commit
2e708e2f
authored
9 years ago
by
Bruno Nocera Zanette
Browse files
Options
Downloads
Patches
Plain Diff
Refactor code: Use correct code pattern
parent
e4f0b6b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/learning_objects_controller.rb
+13
-12
13 additions, 12 deletions
app/controllers/learning_objects_controller.rb
with
13 additions
and
12 deletions
app/controllers/learning_objects_controller.rb
+
13
−
12
View file @
2e708e2f
...
...
@@ -4,7 +4,7 @@ class LearningObjectsController < ApplicationController
# GET /learning_objects
# GET /learning_objects.json
def
index
@learning_objects
=
repository
.
for
(
:
learning_object
)
.
all
@learning_objects
=
learning_object
_repository
.
all
end
# GET /learning_objects/1
...
...
@@ -17,7 +17,7 @@ class LearningObjectsController < ApplicationController
# GET /learning_objects/new
def
new
@learning_object
=
repository
.
for
(
:l
earning
_o
bject
)
.
new
@learning_object
=
L
earning
O
bject
.
new
end
# GET /learning_objects/1/edit
...
...
@@ -27,15 +27,13 @@ class LearningObjectsController < ApplicationController
# POST /learning_objects
# POST /learning_objects.json
def
create
@learning_object
=
repository
.
for
(
:l
earning
_o
bject
)
.
new
(
learning_object_params
)
@learning_object
=
L
earning
O
bject
.
new
(
learning_object_params
)
respond_to
do
|
format
|
if
@
learning_object
.
save
if
learning_object
_repository
.
save
@learning_object
format
.
html
{
redirect_to
@learning_object
,
notice:
'Learning object was successfully created.'
}
format
.
json
{
render
:show
,
status: :created
,
location:
@learning_object
}
else
format
.
html
{
render
:new
}
format
.
json
{
render
json:
@learning_object
.
errors
,
status: :unprocessable_entity
}
end
end
end
...
...
@@ -44,12 +42,10 @@ class LearningObjectsController < ApplicationController
# PATCH/PUT /learning_objects/1.json
def
update
respond_to
do
|
format
|
if
@
learning_object
.
update
(
learning_object_params
)
if
learning_object
_repository
.
update
(
learning_object_params
)
format
.
html
{
redirect_to
@learning_object
,
notice:
'Learning object was successfully updated.'
}
format
.
json
{
render
:show
,
status: :ok
,
location:
@learning_object
}
else
format
.
html
{
render
:edit
}
format
.
json
{
render
json:
@learning_object
.
errors
,
status: :unprocessable_entity
}
end
end
end
...
...
@@ -57,17 +53,22 @@ class LearningObjectsController < ApplicationController
# DELETE /learning_objects/1
# DELETE /learning_objects/1.json
def
destroy
@learning_object
.
destroy
learning_object_repository
.
destroy
@learning_object
respond_to
do
|
format
|
format
.
html
{
redirect_to
learning_objects_url
,
notice:
'Learning object was successfully destroyed.'
}
format
.
json
{
head
:no_content
}
end
end
private
def
learning_object_repository
repository
.
for
(
:learning_object
)
end
# Use callbacks to share common setup or constraints between actions.
def
set_learning_object
@learning_object
=
repository
.
for
(
:
learning_object
)
.
get_by_dspaceid
params
[
:id
]
@learning_object
=
learning_object
_repository
.
get_by_dspaceid
params
[
:id
]
end
# Never trust parameters from the scary internet, only allow the white list through.
...
...
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