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
e4c3b782
Commit
e4c3b782
authored
9 years ago
by
Felipe Bombardelli
Browse files
Options
Downloads
Patches
Plain Diff
add the institutions controller
parent
f0a9bdd4
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/institutions_controller.rb
+77
-0
77 additions, 0 deletions
app/controllers/institutions_controller.rb
with
77 additions
and
0 deletions
app/controllers/institutions_controller.rb
0 → 100644
+
77
−
0
View file @
e4c3b782
class
InstitutionsController
<
ApplicationController
before_action
:set_institution
,
only:
[
:show
,
:edit
,
:update
,
:destroy
,
:like
]
# GET /institutions
# GET /institutions.json
def
index
@institutions
=
institution_repository
.
all
end
# GET /institutions/1
# GET /institutions/1.json
def
show
end
# GET /institutions/new
def
new
@institution
=
Institution
.
new
end
# GET /institutions/1/edit
def
edit
end
# POST /institutions
# POST /institutions.json
def
create
@institution
=
Institution
.
new
(
institution_params
)
respond_to
do
|
format
|
if
institution_repository
.
save
@institution
format
.
html
{
redirect_to
@institution
,
notice:
'Institution was successfully created.'
}
else
format
.
html
{
render
:new
}
end
end
end
# PATCH/PUT /institutions/1
# PATCH/PUT /institutions/1.json
def
update
respond_to
do
|
format
|
if
institution_repository
.
update
(
institution_params
)
format
.
html
{
redirect_to
@learning_object
,
notice:
'Institution was successfully updated.'
}
else
format
.
html
{
render
:edit
}
end
end
end
# DELETE /institutions/1
# DELETE /institutions/1.json
def
destroy
institution_repository
.
destroy
@institution
respond_to
do
|
format
|
format
.
html
{
redirect_to
institutions_url
,
notice:
'Learning object was successfully destroyed.'
}
end
end
private
def
set_institution
@institution
=
institution_repository
.
find
(
"#
#{
params
[
:id
]
}
"
)
end
def
institution_repository
repository
.
for
(
:institution
)
end
# Never trust parameters from the scary internet, only allow the white list through.
def
institution_params
params
[
:institution_object
]
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