In these projects, you’ll be working to implement authentication systems so users can only access areas of a site they are authorized to.
In this project you’ll follow along to Andy Leverenz’s brilliant Building a Twitter Clone screen casts. You’ll be building a light weight version of Twitter and get lot of healthy experience with using Devise in the process.
In this project, you’ll be building an exclusive clubhouse where your members can write embarrassing posts about non-members. Inside the clubhouse, members can see who the author of a post is but, outside, they can only see the story and wonder who wrote it.
If you want to add your own stylistic flourishes, consider it extra credit.
The projects will be less and less explicit about how to achieve their goals, since we expect you to build on your previous knowledge. If you don’t know how to do something, feel free to check back in previous lessons or projects or Google the correct way to implement it (though be careful, because that may take you deeper down the road than we intended).
If you’d like to challenge yourself, don’t even follow the steps below, just go ahead and build the app!
members-onlyRails app and GitHub repo. Update your README.
Let’s build those secrets! We’ll need to make sure only signed in users can see the author of each post. We’re not going to worry about editing or deleting posts.
[:new, :create, :index]methods.
#before_actionto restrict access to the
#createmethods to only users who are signed in. Create the necessary helper methods in your ApplicationController.
app/views/posts/new.html.erbview which will create a new Post.
#createaction build a post where the foreign key for the author (e.g.
user_id) is automatically populated based on whichever user is signed in. Redirect to the Index view if successful.
#indexaction of the PostsController and create the corresponding view. The view should show a list of every post.
Send us your solution by editing this file so we can show others! Submit a link to the GitHub repo with your files in it here using any of the methods listed on the contributing page. Please include your partner’s github handle somewhere in the description if they would like attribution.
|Orlando’s Solution||View in browser|
|Ayushka’s Solution||View in browser|
This section contains helpful links to other content. It isn’t required, so consider it supplemental for if you need to dive deeper into something