Archive for the ‘Rails’ Category

Ten Things Every New Rails Developer Should Know

So, it’s been about a year and half since I started developing in Ruby on Rails. Along the way, I’ve learned a few things the hard way that I’d like to share. These are things that will just make your life a lot easier:

  1. Develop Rails apps on a Mac – Practically every Rails developer develops on a Mac. That means that pretty much every tutorial was written on a Mac. Of course there’s nothing wrong with developing Rails on Windows (I’m thinking of a famous Seinfeld episode here), however, you’re already going to have a steep enough learning curve without having to tweak every other example or tutorial for a Windows machine. Besides, you can only get Textmate on a Mac, which is the subject of my next bit of advice.
  2. Use Textmate – Textmate is the de facto editor for Rails. Again, pretty much every Rails developer I’ve come across uses Textmate and there’s a good reason for it: Textmate comes with a great Rails bundle. You don’t need all the bells and whistles of an IDE – they just get in your way.
  3. Host your first application on a virtual server slice – don’t go the cheap way (like I did) and sign up with a shared web hosting provider. Besides the performance problems you’ll have a hard time using a deployment tool like Capistrano. Get a server slice instead from a service provider like Slicehost that allows you to setup you’re own OS, web server, application server, Ruby and Rails environment, mail service, logging etc. It’s more work initially but it will give you far more flexibility and save you time down the road.
  4. Learn to use a version control system like Git and use a central repository like GitHub – When you’re learning Rails you’ll try a lot of things and then you’ll want to undo everything you just did. That’s where a version control system comes in: it tracks all the changes you make and let’s you either undo or “commit” those changes. A version control system also let’s you branch off different versions and is necessary when more than one person is working on a project. Github makes it easy to share you app with others and gives you an offsite backup.
  5. Learn how to deploy your application to a production server early – even if it’s just the standard “Welcome to Rails!” screen, you’ll save a lot of time down the road when your ready to put your real app into production. Learn and use Capistrano – it lets you roll back changes if something goes awry. BuildingWebApps has great screencasts on deploying an application using Github and Capistrano.
  6. Get at least two books in both online and paperback form – the two books I recommend are Agile Web Development with Rails, Third Edition and Programming Ruby, A Pragmatic Programmers Guide, both by the Pragmatic Programmers. You’ll have these books opened up beside you all the time. There are other great books too: Ruby by Example, Concept and Code is an awesome book for learning ruby step-by-step. But in my view the Pragmatic Programmers books are the “bibles” you can’t live without. Besides, they’re a great publisher.
  7. Buy a 10-pack of screencasts from Peepcode – this excellent series of screencasts will help you to learn Textmate, basic and advanced Rails skills, Git and so on. You’ll definitely need more than one so take advantage of their volume discount. There’s also Railscasts that are 5 to 10 minute free screencasts with a new subject every week. These amazing railscasts will keep your skills honed to a sharp edge.
  8. Start a Rails-related blog – Even if for no other reason then to track your progress and share ideas. Although it is time consuming, posting to a blog is a super way to learn Rails. Don’t bother writing or installing your own blog using Rails (unless you can’t think of any better Rails app to work on). Use WordPress or one of the biggies. Again, it’s hard enough learning Rails and finding time to write blog entries without having to worry about blog setup, hosting, spam, and blog upgrades and maintenance.
  9. Subscribe to a good Rails forum With all of the resources listed above you should be able to handle 99% of the problems you’ll run into, but when you’re really stuck, there’s nothing like a good Rails forum to turn to. I use You may have to be a Rails Studio Alumni to subscribe, however, you can get practically any question answered in 24 hours or less. There are other great forums as well.
  10. Have fun! – Enjoy learning Rails because it is a lot of fun. Don’t get sucked into the stupid debates about which programming language is better than the next, or whether the framework is headed in the right direction. Just focus on learning and building your skills.

I hope this advice will help to set you on the right path from the get go. Now go and build so awesome web apps!

– Chris

DemoCamp Ottawa

I’ve decided to take the plunge and demo one of the Rails applications I developed at DemoCamp Ottawa on Sept 29th. Why am I doing this? I’m probably going to ask myself that question for the next 14 days! But what I really want to do is get more involved with the start up community in Ottawa. I’m also looking for people to assist with this project and any other projects people have thought up but really don’t have the resources to do by themselves – think of it as a kind of like a “start up co-op”.

The point of this exercise is really to have some fun cutting our teeth launching a startup – then we’ll see where it goes from there. My application (in its current state at least) is nothing to write home about but then again it actually works – my family uses it all the time. It needs a registration system, some good design work and some marketing. Oh yeah, some advice from someone who has actually launched a successful start up would be nice too! If anyone can help in these areas come to DemoCampOttawa10 and let’s talk!

I’m told by Ian Graham at The Code Factory that DemoCamp is fun, friendly and very informal and a great venue for exactly what I’m trying to do. Let’s hope he’s right!

Stylish Rails

Scaffolding in Ruby on Rails 2.02 is very simple to use and a great time saver. However, the views that are generated are very, um, well they’re just plain ugly. In addition, they’re not very accessible to users with older browsers or that use assistive technology.

Of course everyone that codes in Rails is an expert in CSS of has access to a professional web designer who can clean up those ugly and inaccessible views really quick, right? Well, not in my one-man show. And all of the reference material that I’ve read on Rails skips over the part that explained how to make your views presentable, usually by simply stating: “Magic Happens Here”. So I learned styling the hard way – by reading everything I could get my hands on.

In this post I’m going to demonstrate how to apply simple styling to scaffold generated views using CSS. I’ll demonstrate how to markup and style a simple form layout that includes a border with a legend and right-justified field labels. Sure, there are plugins you can get to help you out but what fun would that be? Besides, everyone has their own style.

I will be referencing the excellent SitePoint book The Art and Science of CSS. In particular, Chapter 5: Forms, written by Cameron Adams, provides an excellent step-by-step tutorial on creating attractive and accessible forms.

Note that I’m assuming you already know how to use the Rails 2.0 scaffolding feature. If not, there’s lots of material out there that can get you up to speed.

Continue reading

Fun with Ruby and Rails

My interest in web development started when I had a idea for a social website based on the Google maps API. While I had some programming experience it was drastically in need of a major update. I’m still in awe in regard to how much a web developer needs to know. I quickly discovered that I not only needed to learn HTML and CSS but also Javascript, Unix, Subversion, hosting, APIs, text editors and so on. As if that wasn’t enough I added the fantastic web framework Ruby on Rails to my list of things to learn.

While I never really got my Goggle application of the ground (but I will one day), I did finally get my first Rails application up and running: It’s very basic (it’s only designed for my immediate family to use) but it’s functional.

I plan to use this blog to record my journey as I discover the wonderful world of web 2.0 development with Ruby on Rails and Javascript, sprinkled with a little HTML, CSS and who knows what else.