Skip to content

RailsGirlsRome/playlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

               ***     ***
             **   ** **   **
            *       *       *
            *               *
             *             *
              **         **
                **     **
                  ** **
                    *
 ____       _ _        ____ _      _
|  _ \ __ _(_) |___   / ___(_)_ __| |___
| |_) / _` | | / __| | |  _| | '__| / __|
|  _ < (_| | | \__ \ | |_| | | |  | \__ \
|_| \_\__,_|_|_|___/  \____|_|_|  |_|___/

Welcome to the Playlist Rails Girls app!

In this app, users can sign up to create a playlist by uploading mp3 files. Any visitor to the site can view all of the playlists, browse around, and listen to music.

Step 1: Make a Root Page

  • rails g controller playlists

  • add playlist routes

  • see routes with rake routes

  • go to /playslists

  • set root url to playslists index

  • add link to ‘Home’ in layout

Step 2: Create Users

  • rails g devise:install

  • rails g devise User

  • look at new User model; remove ‘recoverable’ module – don’t want to setup email

  • look at the create_users migration; comment out ‘recoverable’ columns and index on reset_password_token

  • add a string column for ‘username’ and add a unique index for this column

  • rake db:migrate

Step 3: Create Playlists

  • rails g model playlist

  • in Playlist mode: belongs to user

  • in create_playlists migration: belongs to user

  • render playlist partial in index

  • create playlist in rails console

  • reload index page

Step 4: Associate Users and Playlists

  • register a new user: add a signup link to the layout

  • add username field to signup form

  • add username to attr_accesible in User

  • user has one playlist

  • create playlist on user create

  • show playlist username in playlist partial

  • complete signup

  • view playlist index

Step 5: Show Playlist Songs

  • create show action

  • link to playlist from username in index

  • rails g model song

  • in song model: has attached file

  • in playlist model: has many songs

  • show username of playlist on playlist page

  • if playlist has songs, render partial

  • write song migration

  • rake db:migrate

Step 6: Upload Songs

  • create songs controller

  • song is resource of playlist

  • define create action: before filter to find playlist

  • on playlist show page: if user is playlist owner, render upload form

  • add file to accessible attrs

  • upload an mp3

  • complete song partial

  • show number of songs

Step 7: Re-order Songs

  • include RankedModel in songs

  • ranks row_order with name playlist_id

  • add row_order_position to accessible attrs

  • rails g migration add_row_order_to_songs

  • rake db:migrate

  • add update action to songs; find song before filter

  • add sortable class to songs table

  • show drag control if user is playlist owner

  • add data-update-url to song table row

  • update playlist show page to rank songs

Step 8: User Sign In/Out

  • update application layout

Step 9: Delete Songs

  • define destroy action: redirect to playlist show after destroy

  • add to find_song before_filter

Step 10: Tighten Up

  • show flash messages

  • add # songs to playlists index

  • link to user’s playlist in dropdown

  • touch playlist when songs saved for ‘last modified’ display

  • validate playlist has user

  • validate song has playlist

  • validate song has attached file

Step 11: Pretty Playlist URLs

  • at to_param and from_param to playlist

  • find playlist by param in playlists and songs controller

  • add contraint to routes

Step 12: Deploy

  • store song files on S3 in production

IMPROVEMENTS

  • rename title of song

  • allow only mp3s to be uploaded

  • use id3 tags from mp3s

  • upload progress

  • Javascript to automatically start next song/prevent two songs from playing at once

  • order playlists by last update

  • paginate playlists

About

❤ My Playlist ❤

Resources

Stars

Watchers

Forks

Packages

No packages published