Giter Site home page Giter Site logo

phase-3-orms-mapping-database-records-to-ruby-objects's Issues

One of the Learning Goals has two ideas - seems like should be two sentences or two different goals

Canvas Link

https://learning.flatironschool.com/courses/5187/assignments/180228?module_item_id=398174

Concern

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.

Additional Context

No response

Suggested Changes

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?

'Song.all' Method Section Needs A Better Flow

Canvas Link

https://learning.flatironschool.com/courses/5286/assignments/172603?module_item_id=376733

Concern

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

Additional Context

No response

Suggested Changes

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

awkward: "for instances in to a particular class."

Canvas Link

https://learning.flatironschool.com/courses/5187/assignments/180228?module_item_id=398174

Concern

I'm not following how "in to" is supposed to work here:
single source of truth for instances in to a particular class.

Additional Context

No response

Suggested Changes

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.

"Song.new_from_db" Method Needs Better Instructions

Canvas Link

https://learning.flatironschool.com/courses/5286/assignments/172603?module_item_id=376733

Concern

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

Additional Context

No response

Suggested Changes

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

Readme issues

Source: Slack Convo

There are a couple of issues:

  1. About 2/3 of the way down the README, this language:

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

  1. It's a code along that never tells students to create a self.drop_table method even though its part of the bin/run file, which they are asked to run resulting in an error.

typo

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.


Link to Canvas

Add a link to the assignment in Canvas here.
https://learning.flatironschool.com/courses/4214/assignments/135642?module_item_id=281531

What should be changed?

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.

Additional context

Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.