Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
programacao_web-trab2
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
Model registry
Operate
Environments
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
Eduardo Machado
programacao_web-trab2
Commits
a55a8f0f
There was a problem fetching the pipeline summary.
Commit
a55a8f0f
authored
9 years ago
by
Eduardo Machado
Browse files
Options
Downloads
Patches
Plain Diff
criado função list all
parent
0939672b
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
runDataBase.rb
+26
-0
26 additions, 0 deletions
runDataBase.rb
with
26 additions
and
0 deletions
runDataBase.rb
+
26
−
0
View file @
a55a8f0f
...
@@ -306,6 +306,32 @@ def list(element)
...
@@ -306,6 +306,32 @@ def list(element)
Addresses_People
.
all
.
each
do
|
a
|
Addresses_People
.
all
.
each
do
|
a
|
puts
"ID:
#{
a
.
id
}
\t
| Address ID:
#{
a
.
address_id
}
\t
| Person ID:
#{
a
.
person_id
}
"
puts
"ID:
#{
a
.
id
}
\t
| Address ID:
#{
a
.
address_id
}
\t
| Person ID:
#{
a
.
person_id
}
"
end
end
when
"all"
# Lista pessoas
puts
"People:"
Person
.
all
.
each
do
|
a
|
puts
"ID:
#{
a
.
id
}
\t
| Name:
#{
a
.
first_name
}
#{
a
.
last_name
}
\t
| Age:
#{
a
.
age
}
"
end
# Lista profissões
puts
"Professions:"
Profession
.
all
.
each
do
|
a
|
puts
"ID:
#{
a
.
id
}
\t
| Name:
#{
a
.
name
}
\t
| Salary:
#{
a
.
salary
}
\t
| Person ID:
#{
a
.
person_id
}
"
end
# Lista emails
puts
"E-mails:"
Email
.
all
.
each
do
|
a
|
puts
"ID:
#{
a
.
id
}
\t
| E-mail address:
#{
a
.
email_address
}
\t
| Person ID:
#{
a
.
person_id
}
"
end
# Lista endereços
puts
"Addresses:"
Address
.
all
.
each
do
|
a
|
puts
"ID:
#{
a
.
id
}
\t
| Address:
#{
a
.
address_house
}
\t
| City:
#{
a
.
city
}
\t
| Country:
#{
a
.
country
}
"
end
# Lista relações entre pessoas e endereços
puts
"Addresses_People:"
Addresses_People
.
all
.
each
do
|
a
|
puts
"ID:
#{
a
.
id
}
\t
| Address ID:
#{
a
.
address_id
}
\t
| Person ID:
#{
a
.
person_id
}
"
end
else
else
puts
"Tabela não existente."
puts
"Tabela não existente."
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