For this challenge, you'll be adding some new functionality to a very basic Sinatra+ActiveRecord application. The application in its current form includes:
- a
Usermodel - a
Topicmodel (representing a topic that a user might have) - a
sign_inview - a
sign_upview
Create routes to allow a user to:
- Sign up as a new user
- Log in as an existing user
- Log out as an existing user
You should not store the user's plain text password in the database.
If you're stuck on part one, please ask for help or move on. Do not spend the entire time period on authentication.
Your task is to add the notion of "skills" to the application. A user can have many topics, and a topic can belong to many users. A "skill" is an association between Users and Topics, and has the following additional required attributes:
- years of experience
- a flag tracking whether or not the user has formal education for the given topic
You need to build CRUD for the "skill" model you create. Keep in mind that a user should only be able to edit and add her own skills, not the skills of other users. A user should also be able to delete her skills, but not the skills of other users.
If you're unsure about what this Part is asking you to build, please ask for help.
Also, the home page of your application should simply show each user, along with each of her topics, how many years experience she has with said topic, and whether or not she's been formally educated in that topic. For example:
| Name | Topic | Years | Formal? |
|---|---|---|---|
| Marie Curie | Ruby | 1 | yes |
| JavaScript | 2 | yes | |
| Max Born | Illustrator | 5 | no |
| CSS | 3 | no |
Reminder - users can view all other users' topics and skills; however, they can only create/edit/delete their own skills.
You can display this data however you choose - do not get hung up on the table formatting in the example.
Please run rake db:drop before you begin to flush any old databases
- What's the right kind of association between
UserandTopic? - Validations on boolean fields can be tricky.
- Before implementing a manual way to add new skills for a user, you might try adding some through your
db/seeds.rbfile.