Week 8 "Loudcloud" Assignment

Click through to see my version of the assignment.

Here's the assignment

We’re going to make something like Soundcloud this week. Users will be able to go to your app, listen to a few tracks and "Like" or comment on each track.

We want our users to be able to interact with the site, but we don’t want to interupt playback when they do. Instead, we’ll use Rails’ remote links and forms and a little bit of Javascript to let everything happen without a page reload.

All the song data will come from a seed file. The Likes and Comments will be added by you via your web browser.

It might be easiest for you to write all the view code in a single file first, then break out the partials as you progress. Your choice.

Loudcloud: seeds.rb (save to db/seeds.rb)

Code quality – I’ll be watching for these...

  • Don’t use return, true or false unless you need to.
  • Indent your code with two spaces. Make sure your indenting is appropriate. Don't have more than one blank line between blocks of code. (Get in touch if you need help configuring your text editor. This should be mostly automatic.)
  • Commit in git regularly (after completing each feature is usually good) with informative commit messages.
  • Add validations where they would be needed.
  • Use before_action to cut down on duplicate code in controllers.


A Song model

  • title (string, required)
  • embed_code (text, required) – this is the HTML that renders the player.

A Like model

  • song (references, required)

A Comment model

  • song (references, required)
  • body (text or string, required)

(Remember to add the relationships in your models.)

Routes and controllers

We are going to have three controllers: Songs, Likes and Comments.

The homepage should be Songs#index. This is the only HTML page that users will actually see.

Limit your routes (using only: []) to the actions you implement.

The Likes and Comments routes should be nested under the Songs route.


Your main page should do the following:

  • List all the songs
  • Display each song’s Like count
  • Let users Like a song
  • Display each song’s Comments (the body and the date the comment was made, newest on top)
  • Each song should have a comment form visible so people can comment right on the page
  • Each comment should have a 'Mark as spam' link that deletes the comment.

When someone clicks Like, the Like count should increase and be displayed on the page.

When someone adds a comment it should be saved and then appear immediately at the top of the song’s comment list.

When someone deletes a comment it should disappear immediately.

Organizing your views

Each song should be rendered with a _song.html.erb partial.

Each comment should be rendered with a _comment.html.erb partial.

Add some styles

Add some styling. You can write it by hand or use something from a CSS framework.

Submit your work

When you are done, push your work to Github. Then email me a link to your repository on Github: alex@dunae.ca