Hello Rails

This year, I began to explore worlds outside of .net, as more than a lurker, and I want to continue to share my steps along the way. This is one of those steps…

Background

The DMB Stream community has grown more than I had ever envisioned when I first created the site. To help celebrate that and give back to the community, I wanted to run a Facebook contest. I read long ago that Heroku and Facebook have a partnership where you can host your Facebook app on Heroku for free. This means no server configuration and it just works 🙂  I have been meaning to make a site with rails, but always fell back into my comfort zone of .net.  Not this time…

Getting Started

I fired up a virtual image of mac osx (I will get a dedicated box as I become more comfortable with non windows environments) and started down the path of installing my development environment.  I used the Rails Ultimate Install Guide and other answers from this StackOverflow post to get the majority of my development tools setup.  Outside of that, I had my trusty Agile Web Development With Rails book next to me to hold my hand throughout this journey.

I should make a side note: I chose to use Heroku’s MongoHQ for persisting data.  They offer free data storage with Mongo, up to 16MB.  I don’t feel I need a relational database and MongoHQ seemed like the easiest route to take for saving contest submissions.

Riding Rails

Since this is my first rails app, it took a bit longer than I expected to get up and running.  That and I made a point to get comfortable with vim which took time as well.  I supplemented the rails book with the getting started guide on the rails wiki.  It compliments my rails book with basic things like hooking up the root route.

After a day or so of using vim, I decided to check out Textmate to see how that compares.  Coming from Visual Studio, I can definitely say that I am more at home using Textmate over vim.  I’m happy I learned vim and have basic usage down.  I know I could continue to improve my efficiency with vim, but I really like the project like view that Textmate offers.  Being able to quickly select any file in the rails tree is a major deciding factor for me.

As far as rails itself goes, I have really enjoyed working with that framework.  Rails feels between one and two major releases ahead of asp.net mvc.  All of the built in helpers, asset pipeline, etc are all time savers and magically work with no configuration/custom code.  The only thing that feels less mature than asp.net mvc is validation.  Rails has model validation, but I have yet to find something along the lines of the unobtrusive jquery validation that asp.net mvc provides.  That doesn’t mean it isn’t out there…

That’s one of the downfalls that I have found regarding Rails.  Finding up to date information for the current version of rails isn’t the easiest thing in the world.  There’s a lot of blog posts and examples out there for rails and a good chunk of those are for older rails versions.  Sometimes the examples work, sometimes the latest version of rails looks nothing like what’s in the example.

Heroku, GitHub, and Mongo

What can I say about Heroku? It’s amazing and such a pleasure to use; I don’t see myself using another rails host at this point.  They continue to innovate and offer solutions with the same vigor that Amazon does with their web services.  Heroku pricing is extremely attractive as well.  Host any number of small sites for free and they’ll scale on demand, when that time comes.  Deploying to heroku is so simple and easy… MS could learn a lot from them (that is, if there are any passionate people left on that stack).  Yes, I understand that there is AppHarbor, but deployment options for .net are outdated, limited, and overall complete shit.

Not much to say about GitHub either… it’s what everyone uses these days for source control.  I used both the command line git client and GitHub’s mac client with my project.  Both have benefits and the gui client is so simple and elegant… I still really enjoy Kiln for my .net projects, but I’ll be in git land for everything else.

I chose to go with MongoHQ for data persistence.   MongoHQ and Heroku have a partnership that provides the free 16MB plan to each heroku app.  If your app requires more storage than that, MongoHQ price levels won’t break your bank.  There are no license fees or worries about infrastructure.  MongoHQ has multiple libraries available for non rails environments as well (including .net and java).  They even have a similar partnership with AppHarbor.  Rails by default is setup to use ActiveRecord and a relational database.  Have no fear, it’s easy to override those defaults and MongoMapper wraps mongo in a way that makes working with it feel very similar to a traditional database.

Conclusion

While I was building this application, I found myself thinking that I should be doing busy work type things, but there really isn’t a lot of that to do with the rails stack.  For small/medium sized sites, it’s geared to help you realize your ideas rather than getting lost in architecture and useless technical rants.  To get started, that’s all I need… If the site ever gets too big or cost prohibitive for rails, it should monetize itself enough at that point to facilitate alternatives.

At this point, I’m planning out my next project and will be using the same frameworks to make it a reality.  It’s more complicated than a simple facebook app, so it should be a nice next step for my rails experience.

I feel that innovation and excitement have long moved away from the Microsoft stack and the trend seems to continue among developers.  There are many other things going on out there and in general, it feels like .net is treading water and playing catch up.

As slanted as this post may seem, I haven’t given up on .net.  I still have a fondness for it, but I would be stupid to ignore the rest of the web.

3 thoughts on “Hello Rails

  1. I found Mongoid to be much better than MongoMapper, but it looks like that community (MM) has started doing more frequent updates. Also, if you decide to keep looking at VIM (which I use) I wouldn’t try it without installing rails.vim from tim pope, and NERDTree plugins. These allow you to have a project view pane, and the rails plugin is just fricking amazing.

    I honestly don’t use the tree much once you learn the plugin, you just ask for things by convention and it finds the right file.

    Grats on checking out rails, I agree that it’s much more mature, and the community understands the MVC pattern and REST as a whole much better.

    1. Thanks for the tip on the vim plugin! I’ll take a look at vim again, with it installed… I’ve heard that vim can be VERY fast to use… maybe that plugin makes the difference, though.

      Can you elaborate on how Mongooid is better than MongoMapper? Since I was new to the stack, I went with the first tool that was presented in the heroku docs – and at a quick glance, it seemed to be the least friction to get going with

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.