Home


Welcome to RailsRocket, a community Ruby on Rails website! We have forums, so check those too; we hope this will help you with your Ruby on Rails projects!

Newest Articles

  • The Controversial Eval Function [November 11, 2008]: eval is a function in Ruby that allows you to execute arbitrary code. You pass in a string containing code, and voila! It’s very useful, for things like holding pointers of a sort to functions; but it’s also dangerous, because script-kiddies can format your hard-drive. So what’s the middle-path use-case of eval?
  • Block Comments in Ruby [November 5, 2008]: How do you comment out a chunk of code? Other programming languages (C++, Java, etc.) have a slash-star style of block comments, like so: /* */ … but what about Ruby? Does Ruby have a mechanism for this, too? The answer is YES; BUT, there’s a catch! If you don’t watch whitespace …
  • Regular Expressions in Ruby (and Rails) [October 28, 2008]: How does Rails, or rather, Ruby, deal with Regular Expressions? There are a few things; first, the syntax for regular expressions is a bit unique in Ruby. Second, the String class has a few methods that you can use for regular-expression use–namely match and gsub, which you can use to match (groups) and access matches.
  • Conditional Code [October 21, 2008]: You’re writing some code for a new client. Debug statements litter the code. Oops, you sent that to the client. Oops, you’re printing out credit-card numbers. Identity theft ensues. Don’t move to Mexico–you can actually handle this problem in an elegant way by using conditional code statements INSIDE your class …
  • Bort: Better Skeleton Applications [October 9, 2008]: bort is a replacement for your standard Rails application skeleton. It comes with Restful Authentication, Will Paginate, code for using a MySQL database, database sessions, and more! Use it instead (it won’t hurt you), and it’ll help you bootstrap your Rails applications even faster (and in a better way)!
  • CSS Progress Bar [September 30, 2008]: How can you create a progress-bar with pure CSS, no images? In this post, we discuss one such attempt by Launchpad–where we have a target article-count goal, which we display in the dashboard. And we use a progress bar that’s pure CSS.
  • String Replacement in Ruby [September 25, 2008]: How can you replace strings in Ruby? There are a couple of options; there’s the tr function, which takes two sets of characters, and substitutes them; and there’s the gsub method, which makes a global replacement based on a regular expression. Powerful stuff!
  • Ruby Command-Line Arguments [September 20, 2008]: How can you access command-line arguments in Ruby? Through the special array called ARGV. It’s a zero-indexed array of your command-line arguments; so ARGV[0] is the first, ARGV[1] is the second, and so on. You can use ARGV.length to get the number of arguments, too.
  • Launchpad [September 17, 2008]: Launchpad is an open-source article-based CMS and blogging platform for Rails. It has all the features you come to expect from a CMS, like admin-only edit links, commenting, voting, RSS feeds, future-publishing posts, and user registration. Best of all, it’s written 100% in Rails!
  • Rails 2.1: Increment and Decrement Value [September 15, 2008]: Prior to Rails 2.1, the increment and decrement functions needed to be called multiple times if you wanted to increment/decrement by more than one. In Rails 2.1, you can pass in a second parameter: a value, how much to increment or decrement the field by. (And it can take negative values.)

Most Popular

  • Passing Controller/View Data with Instance Variables
  • Rails 2.1: Named Scope
  • Migrating to Rails 2.0
  • Site-Wide Layouts
  • Rails 2.1 eBook
  • Acts_as_Authenticated Plugin
  • Bort: Better Skeleton Applications
  • Redirecting in Rails
  • Scaffolding in Rails 2.0
  • Rails 2.1: Aggregate Expressions

  • Highest Rated

      Posted in Uncategorized

    Leave a Reply