Skip to content

Twittter - A tutorial of how to clone some features of Twitter using Ruby on Rails

Notifications You must be signed in to change notification settings

harshgujrati/twittter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Let's Build: With Ruby on Rails - A Twitter Clone

feature-image

Welcome to our next Let's Build! This build introduces a well known social media giant Twitter into the mix as inspiration for the project. We will be creating a knock-off of sorts called Twittter.

This app will most notably demonstrate a user role system giving your web application and navtive application feel all within the browser. I'll be going bit faster than the previous build as it was more of a foundational exercise where I explained common concepts revolving around the Ruby on Rails ecosystem. We'll make use of Rails generators to help scaffold some of the things I've already covered. If you haven't watched the first Let's Build, I invite you to do so in order to understand what we are doing.

Download the source code

Download the source code

What we are building

The app itself will feature a basic CRUD principle where we can create, read, update, and destroy Tweeets. In essence, this is the same as my previous build where we created posts for a blog. On top of the Tweeets, I introduce a new gem called Devise which makes creating an entire user role and authentication system easy. Combined with this gem we can authenticate users who want to author Tweeets. A user's Tweeets are then also tied to their account. The end result is a public facing site with a stream of tweets from different users. Users that have and account can login to create their own Tweeets to add to the public stream.

What we won't be covering

Twitter is pretty elaborate application. I won't be covering replies, retweets, likes, and quite a few other foundational features of the famous social media giant. Instead I invite you to tinker with how to possible add those features. Similar to the blog with comments build I did, see if you can figure out how to add replies to the application on your own. (Tip: It's the same as adding comments to the blog post as I did in the previous build ;) ). I may revisit this app to add more features as another exercise but I truthfully ran out of time! Let me know if you'd like to see me extend this further.

There are also a few gems in the wild for "liking" posts. Here's a favorite of mine

Note: One big error I noticed after calling it quits on this build was that any logged in user could edit any other user's tweeets. This is a big security flaw as a user's abilities should only lie within their own account. See if you can find a way to only allow the current logged in user to edit their own tweets and not other users. I may revisit this series to extend and address these issues.

Ruby gems used in this build

  • Better Errors - For better errors

  • Bulma - for easy CSS. Feel free to roll your own styles and/or use a different framework.

  • Guard - Useful for live reloading our scss, js, css, and erb files, although it's capable of much more!

    Guard is required for the Guard LiveReload gem to work

  • Guard LiveReload

  • Simple Form - For simple forms!

  • Devise - Effortless user roles and authentication

  • Gravatar_image_tag - Integrated image tag which spits out gravatars.

Continue reading on web-crunch.com

About

Twittter - A tutorial of how to clone some features of Twitter using Ruby on Rails

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 67.8%
  • HTML 29.2%
  • JavaScript 1.4%
  • CSS 1.3%
  • CoffeeScript 0.3%