learn-co-curriculum / phase-3-orms-mapping-database-records-to-ruby-objects Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
https://learning.flatironschool.com/courses/5187/assignments/180228?module_item_id=398174
I'm not following how "in to" is supposed to work here:
single source of truth for instances in to a particular class.
No response
maybe change this:
single source of truth for instances in to a particular class.
to this?:
single source of truth for instances in a particular class.
or
single source of truth for instances from a particular class.
or
single source of truth for instances of a particular class.
or
single source of truth for instances for a particular class.
Maybe this...:
single source of truth for instances into a particular class.
Thanks for raising this issue! Future learners thank you for your diligence. In
order to help the curriculum team address the problem, please use this template
to submit your feedback. We'll work on addressing the issue as soon as we can.
Please fill out as much of the information below as you can (it's ok if you
don't fill out every section). The more context we have, the easier it will be
to fix your issue!
Note: you should only raise issues related to the contents of this lesson.
If you have questions about your code or need help troubleshooting, reach out to
an instructor/your peers.
Add a link to the assignment in Canvas here.
https://learning.flatironschool.com/courses/4214/assignments/135642?module_item_id=281531
Typo. Changes in brackets:
"One [thing] to know is that the database, SQLite in our case, will return an array of data for each row."
Suggest your change here. Let us know what section or line of the Readme needs
to be updated, and any proposed corrections. Include the line number(s) if
possible.
Add any other context about the problem here.
Source: Slack Convo
There are a couple of issues:
Now, all we have to do is iterate over each row and use the self.find method to create a new Ruby object for each row:
self.find
should be self.map
self.drop_table
method even though its part of the bin/run file, which they are asked to run resulting in an error.https://learning.flatironschool.com/courses/5286/assignments/172603?module_item_id=376733
The following section is a bit awkward and shouldn't have been broken down in its bare minimum sections. This should have the entire method included each time since it just comes out of nowhere and is just ambiguous to follow along with:
Related Section:
To return all the songs in the database, we need to execute the following SQL query: SELECT * FROM songs. Let's store that in a variable called sql using a heredoc (<<-) since our string will go onto multiple lines:
sql = <<-SQL
SELECT *
FROM songs
SQL
No response
Correction:
class Song
# ... rest of methods
def self.all
sql = <<-SQL
SELECT *
FROM songs
SQL
end
Next, we will make a call to our database using DB[:conn]. This DB hash is located in the config/environment.rb file:
class Song
# ... rest of methods
def self.all
sql = <<-SQL
SELECT *
FROM songs
SQL
# NEW:
DB[:conn].execute(sql)
end
end
https://learning.flatironschool.com/courses/5187/assignments/180228?module_item_id=398174
Somewhat confusing:
...that accepts one argument, a name
searches the database for a song with that name
This is part of the third of four learning goals, so the reader should be able to read from the first word to the last without effort. However, there are two concepts here so seems like there should be two sentences.
No response
maybe change this:
...that accepts one argument, a name
searches the database for a song with that name
to this?
...that accepts one argument, a name.
It searches the database for a song with that name
Or maybe "It searches the database..." is supposed to be its own bullet/goal?
https://learning.flatironschool.com/courses/5286/assignments/172603?module_item_id=376733
This section should be revised with an actual directive to tell the student what to actually do since its a bit ambiguous:
One thing to know is that the database, SQLite in our case, will return an array of data for each row. For example, a row for Michael Jackson's "Billie Jean" from the album "Thriller" that has an id of 1 would look like this: [1, "Billie Jean", "Thriller"].
class Song
# ... rest of methods
def self.new_from_db(row)
# self.new is equivalent to Song.new
self.new(id: row[0], name: row[1], album: row[2])
end
end
No response
REVISIONS:
One thing to know is that the database, SQLite in our case, will return an array of data for each row. For example, a row for Michael Jackson's "Billie Jean" from the album "Thriller" that has an id of 1 would look like this: [1, "Billie Jean", "Thriller"].
Let's get started by opening up "lib/song.rb" and using the following code:
class Song
# ... rest of methods
def self.new_from_db(row)
# self.new is equivalent to Song.new
self.new(id: row[0], name: row[1], album: row[2])
end
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.