- Organize controllers using a module.
- Use namespaced routes.
We're going to add some administrative functions to our song library.
Using what we learned about namespaced routes and module scope, we'll
organize our controllers and routes under an admin
namespace to keep
them separate from the regular user functions.
The base application has been provided with tests. Make sure to run
rake db:seed
to set up seed data. Tests can be run with rspec
.
Note: Since we're building new features on an existing project that already has tests, part of the job is to make sure the tests that already pass at the beginning still pass when you're done!
- Create a
Preference
model that will store preferences for the app. It will need to have fields for: - Song sort order (e.g.
"asc"
or"desc"
). This will be used to control the default sort order on the/songs
page. - Artist sort order. This will be used to control the default sort
order on the
/artists
page. - Allowing creation of new songs. Used to control the ability to add new songs to the system.
- Allowing creation of new artists. Used to control the ability to add new artists to the system. for artists and songs.
- Create a
PreferencesController
, routes, and views to manage the preferences. Do this under anAdmin
module to separate it from the standard user functionality. - Update the artists and songs
index
pages to order byname
according to each preference. - Update the
songs#new
andartists#new
actions to check that creating new songs or artists is enable, and redirect to/songs
and/artists
, respectively, if that preference is disabled. - Make sure tests pass.
- Ride the bull. Feel the flow.
View Objectives on Learn.co and start learning to code for free.