A Rails practice app.
This app is supposed to help people organize barbecues but it's got a few problems.
As it is now, anyone who visits the site can create a new barbecue. We would like visitors to have to register before they can access the site.
- Add authentication to the app with devise or the method of your choice.
- Prevent anonymous users from accessing the routes of
BarbecuesController
. - Add a small user profile header section with the user's name, email and a log out button.
The list of barbecues has links to the individual barbecue pages. If you open one of those pages, instead of seeing the barbecue's information you get an error. As it turns out, the barbecue page is trying to call an API via JavaScript to retrieve that data.
- Create a route that responds to GET requests on URLs like
/api/barbecues/:id
, where:id
is a placeholder for a barbecue's ID. - The API needs to respond with a JSON object with the barbecue's
title
,date
andvenue
properties.
On the home page you might have noticed that each BBQ has a Join button. If you try to click that button, you will get an error. That button also attempts to use of an API call to add the user to the BBQ.
- Add an association to
Barbecue
for the users who are going to the BBQ. - Create a route that responds to POST requests on URLs like
/api/barbecues/:id/join
, where:id
is a placeholder for a barbecue's ID. - The API needs to add the logged-in user to the selected BBQ's association.
- The API should also respond with JSON indicating whether or not the call was successful.