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

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!

Are We the Real Problem with Media Today?

Editors note (Nov 12, 2013) – since the release of TheRationalDebate 2.0 in November 2013, some of the features mentioned in this article are no longer supported on the site.  Specifically, the ability to debate issues by posting arguments and comments.  This post remains however – we can still apply these concepts to how we argue issues on the internet today.

Larry Womack wrote an article earlier this week over at the Huffington Post titled: The Real Problem With Media Today? The Audience.  One of the main points of the article is that most reporters and media outlets don’t actually go through that much effort, if any at all, to check facts that their sources give them.  The reason?  Because it’s much more profitable not to, and we (the public) don’t really want the facts anyway.

But none of this would matter if delivering hard news actually made financial sense. If people made money reporting real news, believe me, they’d report it. The real problem is there’s no money in truth. And the fault for that lies with the you and me, the audience.

The article triggered a Google Alert I have set up, and while reading it I thought “Hey – a lot of the points he’s bringing up in this article are reasons why I created TheRationalDebate in the first place!”  Whether or not you agree with Larry, I’d like to focus on some quotes from his article, and post my thoughts on how it relates to why I created TheRationalDebate.

All quotes in this article are from: http://www.huffingtonpost.com/larry-womack/the-real-problem-with-the_1_b_1207888.html

… you’ve probably noticed that a great many people on [the internet] respond to correction or presentation of fact with anger and even more deeply entrenched — if demonstrably incorrect — views. Just take a look at the comments on any given web site; the angrier or more dismissive one is, the less likely it is to be based in reality.  Just take a look at the comments on any given web site; the angrier or more dismissive one is, the less likely it is to be based in reality.

The last part of this quote is exactly what I’m trying to avoid.  With TheRationalDebate, I think we can have a community of people who rationally discuss issues and can comment on opposing arguments without resorting to irrational behavior.  The community having the power to hide irrational arguments and comments, no anonymous arguing and commenting, and the overall tone of the site are a key components to what we’re trying to do at TheRationalDebate.

That is what the most profitable news sources too often provide: a steady stream of reinforcement without fear of making the audience ever genuinely feel like they might be wrong about some political opinion.

…too many of us seek out only that information (be it true or untrue) that reinforces our prejudices, reassuring our fantasy selves that we are, indeed, champions of all that is right and just.

It’s hard today to find really good arguments on all sides of an issue.  Most media outlets will try to appear non-biased by throwing a line or two dedicated to the other site, but usually it’s pretty clear which side is “correct” in their opinion.  Media outlets know that it’s easier, cheaper, and more profitable to simply tell you what you want to hear.  At TheRationalDebate, this is exactly what I’m trying to fix by building a community of rational people providing really great arguments for all sides of an issue in one spot.

So – what can you do?  If you have some really great arguments on important issues today, sign up and post them!  If you don’t want to create arguments, that’s ok!  You can still sign up to vote and comment on issues. If you know someone who does have really great arguments invite them to join in.  My last post has instructions on how you can invite others to TheRationalDebate.

I believe that we can make discussing issues better on the internet today, let’s get started!