Skip to content

Instantly share code, notes, and snippets.

@josephmosby
Created December 8, 2012 22:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save josephmosby/4242213 to your computer and use it in GitHub Desktop.
Save josephmosby/4242213 to your computer and use it in GitHub Desktop.
Week One of Ruby on Rails: Step Backwards

I am taking a step back in my Ruby on Rails journey, as it seems that my initial goals may have been a bit too ambitious.

As I said in a previous post, this is not my first foray into web applications. I've been working with Python and its associated frameworks for some time. When I was asked by a friend to work with Ruby, I thought that there would be a fair amount of similarities between Rails and Django given the structural similarities between Ruby and Python. I could not have been more wrong.

The Ruby and Python communities have taken their languages in completely different directions, and that's just fine. Ruby has no Benevolent Dictator for Life like Guido van Rossum, and 37signals has rejected any implications that their organization can be the sole deciders for Rails. That leaves a community free to evolve however it chooses to do so. There are pros and cons to this. Ruby (and consequently, Rails) has the ability to change and grow into its users' needs far more quickly than Python. That comes with its own set of growing pains, which I encountered in my first efforts in building a demo application.

Ruby makes heavy use of gems, which appear to be like more complex Python libraries. I say "more complex" because they appear to bolt onto each other far more heavily than Python libraries. If I want to make a complex application run, chances are I'll need five gems to do it... and versioning is extremely important. I was following an application template that clearly spelled out all the gems and versions I would need to build it, but hit my first snarl when one gem wasn't quite prepared for Ubuntu 12.04 as its creator had placed some dependencies on OS X. I went debugging and fiddled with the gem to redirect it to its new home in Ubuntu, only to find that my debugging had caused problems with Rails. At this point, I decided that I should probably get a firmer understanding of the core of Rails before I started messing with gems.

So, ye Rubyists, who were so helpful last time with my RSpec gaffes - how do you manage dependencies like this? Are these gem heartburns a common problem in Ruby/Rails or is this mostly due to my ineptitude with the language?

Copy link

ghost commented Dec 9, 2012

Well, this was total linkbait. If the application template you were following was so outdated it didn't discuss Bundler, you need to find a new application template. Am I really supposed to believe that Python libraries never have C modules with OS-specific behaviour? Or that their interfaces never change to the point something like bundler isn't a must? I'd rather specify my exact versions than hope whatever is installed on the system happens to have the API version I want to use.

@arthurnn
Copy link

arthurnn commented Dec 9, 2012

again, as @sujithrs and @r4vi said, always use rvm .. ruby, python have a lot of dependencies that some times requires c, c++ libs that I compiled for your system, so it is really easy to mess around when u install everything in a system context.
One think that I found out when I moved from python/django to ruby on rails was that for my python project I kind of had to create a virtual box in order to have system as close as production, but in my ruby on rails environment I dont need to do so, I run everything in my local MacOS and our prod environment(ubuntu) always worked just fine.

@bradland
Copy link

bradland commented Dec 9, 2012

Interesting that you've run in to OS X specific dependencies in the Rails ecosystem. I don't know anyone who deploys Rails apps to OS X in production. Xen based VPS is so incredibly popular, that pretty much everyone deploys to some kind of Linux.

Bundler and RVM (specifically, it's gemset features) are my tools of choice for managing my Ruby environment in development. For web apps, my production environments are usually virtualized, so I don't need RVM there. I use ruby-build to compile Ruby from source on servers, rather than relying on the system packages, which are always out of date and often broken. You can get almost all of RVM's gemset functionality with Bundler, but I like the utility of commands like rvm gemset empty (this command will completely wipe out any gems in the current gemset) when I'm developing. It's handy for building from zero, and feeling confident about what gems are available in the current environment.

@borland
Copy link

borland commented Dec 9, 2012

I used to be a rails developer about 4 years ago before switching jobs... This was before RVM, Bundler, etc... Back then, you just installed ruby, whatever gems, and then you were done. Now it seems like RVM is needed to "manage the ruby environment" and then Bundler is needed to manage sets of gems. What the heck? Whatever happened to just "Install ruby, Go". No wonder people are getting upset with it. It seems ridiculous

@rbucker
Copy link

rbucker commented Dec 10, 2012

I'm not crazy of any language or toolchain that has a deep and version specific dependency try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment