TheRationalDebate Technology Stack

For those of you who know me, you know that I created TheRationalDebate for two main reasons.  The first reason is, obviously, that I really do not like irrational debates (especially on the internet) and I do not like when people site facts without backing up their sources.   The second reason is the technology.  I built the site almost exclusively with technologies that I don’t get to work with in my day job.  The posts so far have been all about the first reason I built the site, so I figured it would be good to do a post about the second.

10,000 Foot View

At a high level, TheRationalDebate is a web application written in Ruby on Rails running on the cloud hosting service Heroku.

I chose Rails mostly because I wanted to sharpen my Ruby and Rails skills.  Plus it’s a lot of fun to code in, and there are tons of open source plugins (what Ruby calls ‘gems’) available to use that make hard things pretty easy.  I’ll talk more about the gems I’m using later.

Heroku revolves around the concept of a ‘dyno’, which is sort of like a server, but it can only process one request at a time.  For tech readers, think of a dyno as more of a web worker thread rather than an actual server.  I chose Heroku for two reasons.  First, it’s really easy to deploy TheRationalDebate to Heroku.  No messing around with servers, databases, etc.  I can simply push my code to Heroku and their software takes care of the rest.  The second reason is price.  I’m running TheRationalDebate at a total monthly cost of $0.  Can’t beat that.  For a small site like mine, I only have one ‘dyno’, and it’s free.  The only downside to this approach is only one user can make a request at a time.  In other words, if you and I point our browsers to the homepage at the nearly the same time, I’m going to have to wait for your request to finish before the server even starts working on mine.  This is also why the Rational button can’t post URLs on TheRationalDebate.  It would create a request that triggers a circular request to the site.  My one lonesome dyno can’t keep up.  This limitation would be a huge flaw for a bigger site, but again, the hosting is free.  If the site ever needs it, I can scale up the dynos to increase performance (for a monthly fee, of course).

User Interface

On the front end, I’m mainly using jQuery and Twitter Bootstrap.  As I mentioned in my last post, I’ve never been confused with a graphic designer, so the CSS is pretty much out of the box.  I am using the Cerulean Bootswatch theme.  I’m still using Bootstrap 2.x; I’ll probably upgrade to 3 at some point when the mood strikes me.

I’m also using a really cool JavaScript library called Isotope to organize Opinion Boards on a user’s profile page.  You can create some pretty neat dynamic layouts.  Here’s an animated gif showing how off how I’m using some of the features:

boards-isotope-layout

If you want to play around with it yourself, go to my Opinion Boards, or create your own boards!

Other Gems of Note

Getting down into the nitty gritty, here are some other Ruby gems I’m using that you might find interesting:

Devise

Devise handles user registration and user sign in/out, manages encrypted passwords in the database, and provides features for password recovery and user verification.  Devise is truly a fantastic gem.  It would have taken me forever to build something anywhere close to this.

Omniauth

Omniauth works with Devise to allow users to sign in to the site via Facebook.  Omniauth is based on the OAuth standard, and supports other authentication providers as well (Google, Twitter, many others).

Paperclip

Paperclip is a simple gem that allows you to attach files to database records.  On TheRataionalDebate, I’m using it to attach an avatar image to a user’s profile.  Another great thing about Paperclip is that it seamlessly integrates with Amazon S3.  I’m using S3 to store uploaded avatar images since Heroku is a read-only file system (which means I can’t store avatars directly within the app).

Turbolinks

Turbolinks makes a site filled with normal anchor tag links work like a JavaScript app by turning those links into Ajax requests.  Without doing anything to my code, Turbolinks improves the site performance while seamlessly degrading to normal links for older browsers.  Turbolinks is also is the main reason I put the “Loading” gif and transparent backdrop between page loads.  If I hadn’t, there would be no user feedback that the page was loading since the normal browser spinner doesn’t spin.  If you don’t see the Loading gif and backdrop between pages, it means your browser is too old to support Turbolinks.  Upgrade your browser!

CanCan

CanCan is a cool little gem that makes user authorization a snap.  I use it to make sure that you can only edit your boards and posts.  If you go to my boards, you won’t be able to edit anything because of how I’m using CanCan.

If You Insist (on geeking out more)

  • HAML and SASS – makes coding HTML and CSS much better.  Less code, more productivity.
  • simple_form – If you’re coding a rails app with the out of the box form_for method, you’re missing out.
  • client_side_validations – I have client-side validations working as much as I can for now, but there are certain places (I’m looking at you, Devise and Bootstrap) that caused problems.  I could probably iron out all the places where I couldn’t figure out how to get client side validations working, but at this point it’s not worth the time.  In case you’re wondering, yes I am using client_side_validations-simple_form and client_side_validations-turbolinks gems as well.

If you made it this far, thanks for reading and let me know if you have any questions about TheRationaDebate’s tech stack!

Advertisements

Post Links to Facebook with the Rational Button

Do you like to post links to Facebook?  If you do, the Rational Button makes it really easy for you to post anything you see on the web to Facebook.  Get the Rational Button here.  Here’s how it works:

While browsing the internet, you come across an article, video, etc. that you think is a well thought out, rational source for your opinions.  Click the Rational Button on your browser toolbar to bring up a window to post it:

rational-button-fb-2.0

If your account is connected to Facebook, you can post the article to Facebook right from here!  In the screenshot above, the Facebook icon is checked, so the link will be posted on Facebook.  Don’t want to post the article to Facebook?  Simple, just uncheck the Facebook icon.

If you decide to post to Facebook, here’s what it will look like on your timeline:

Here’s what the post will look like on Facebook.  The ‘R’ icon is my Facebook profile picture.  If you post, your profile pic will be there instead of the ‘R’.

It will look exactly the same as if you copied and pasted the URL in your status update bar on Facebook.  The only difference is the ‘via TheRationalDebate’ text at the bottom.

If you already have an account on TheRationalDebate but haven’t connected to Facebook yet, use the Rational Button to post something.  The window will give you the option to connect your account:

rational-button-fb-connect-2.0

If you don’t have an account on TheRationalDebate and you want to get started, the easiest way is to sign up using the ‘Sign In with Facebook’ button.  Click the Facebook button to sign up and connect your account to Facebook in one step!

Hit the Rational Button

When you’re browsing the web and you read or watch something that you want to remember as a source for your opinions, what do you do?  You’d like to remember it and organize it somehow, but how can you do that so it’s separate from all the other bookmarks that you have?  The answer is simple – post it to your Opinion Board on TheRationalDebate.  This is now easier than ever: you can click a Rational button on your browser toolbar to post it directly to your Opinion Board.  Get the Rational button here!  Here’s an example of how it works:

A friend of mine posted an article to Twitter from The Economist, and while reading it I thought it was really good article that I will want to remember as a source for my opinion on vaccines.  So, to add this article to my Opinion Board, I can simply click the Rational button on my browser toolbar:

rational-button-1-2.0

Clicking the Rational button causes a window to appear right on the page:

rational-button-2-2.0

Now I simply pick the Opinion Board I want to post the article to (or I can create a new board if I want), add my comments and click the ‘Add Post’ button and it’s done!

rational-button-3-2.0

Once the post is created, I can either click the link to check out my Opinion Board, or simply close the window to go back to reading the article.  Easy!  The screenshots above show the Rational button in Chrome, but it’s also been tested with Internet Explorer 8+, Firefox, Safari, and Opera.

Get the Rational button for your browser and start bookmarking rational sources out on the web today!

If you’re curious about seeing my Opinion Board on vaccines, check it out here.  If you agree with me, sign in or sign up and repost my sources to your board to get started.  If you disagree, I’ve yet to see any rational arguments against vaccinations, so let’s see your Opinion Board!

Organize Your Sources and Opinions on TheRationalDebate

It’s really tough to compose a well thought out rational argument without choosing reliable sources and organizing them somehow.  With that in mind, how do you organize your sources and opinions?  While thinking about this after TheRationalDebate launched earlier this year, I realized that a great addition to the site would be something that lets you organize your sources and opinions.  I’m happy to announce that you can now use TheRationalDebate to do exactly this by using the new Opinion Board feature!

How Opinion Boards Work

You can post any URL to your boards on TheRationalDebate.  It can be a blog article, a YouTube video or anything else on the web. If it has a URL, it can be posted.  For example, let’s say you want to organize your opinion on global warming.  So you’re browsing the web, and you come across a great article from NOAA on some recently published research.   Simply post the URL of the article to your global warming board.  You can do this by copying and pasting the URL, or by using the rational button.  As you do this for other pages on the web, your board will help you cultivate your sources and learn more about the subject.

The homepage on TheRationalDebate has changed to show a site-wide feed of Opinion Board posts. (Editors note – as of November 2013, the homepage has been simplified.  You can still search for Opinion Boards using the search feature at the top).  As you’re reading what other people have posted, you may find something that you want to post too.  You can do this really easily by reposting the URL to your board.  Just click the repost link on any post: repost-2.0

Using Opinion Boards to Organize and Share Your Opinions

Use your boards to bolster your opinions before creating a rational argument, or use the board to help form your opinion if you’re not yet sure.  Either way, now that you’ve organized your sources, the next time you’re discussing global warming with a friend, all of the sources that help form your opinion will be organized in one spot.  You can even share your board with your friend on Google+, Twitter, and Facebook.  The basic building block of a rational, well thought out argument is credible sources based on facts.  The next time you’re arguing an issue with someone, ask to see your friend’s opinion board when they cite facts they heard “somewhere”.  And be ready with sources on your boards.

Opinion Boards are not limited to global warming or politics.  You can create as many boards as you want for whatever you want.  Are you a teacher?  Create education boards that track sources for how you think your school can be improved. Do you love sports? Create a board on why you think the Cubs will be a contender in the next few years.  It’s really up to you – create Opinion Boards for anything.

What’s Next for Opinion Boards

There are many updates planned for Opinion Boards, including Facebook integration, the ability to ‘follow’ another person’s boards, and a browser plugin that will let you post to your boards right from you browser toolbar.  As you’re using your new Opinion Boards, I’d love to hear your thoughts on what we should add. Get started creating your Opinion Boards and then let us know what you’d suggest to make it better.  Let us know in the comments, or contact us.

Invite Your Friends to Join TheRationalDebate

Do you know someone who needs to organize their sources for arguments?  Were you having a discussion with someone who didn’t have backup for their claims?  If you do, then invite them to join TheRationalDebate.com.  It’s easy!  Once you login, click the arrow or your name in the top right corner:

invite-menu-item-2.0

Just click the invite item, and a dialog box will pop up:

invite-dialog-2.0

Put your friends’ email address in the “To” box.  If you want to send the invite to more than one person, simply put a comma between each email address.  You can personalize the email text by putting in your name (just click the gray box to change it), and you can also add whatever text you want to personalize the message.  After clicking the ‘Send Invite’ button, we’ll send the email and you’ll get a confirmation screen:

invite-confirmation-2.0

If you want to send another invite, just click the ‘Send Another’ link!

Editors note – this post was updated on November 12th, 2013 to update the text and pictures reflecting site updates since the post was originally published.