Search
Categories
- Deployment (4)
- Development (63)
- Gems and Plugins (4)
- News (2)
- Projects (4)
- Testing (3)
Most Popular Tags
activerecord architecture collections css database date and time debugging design design patterns DRY ebooks fixtures floating-point numbers formatting framework front page global variables helpers I18n introductory launchpad meta-information migrations model multiplicity mvc MySQL partials production rails 2.0 rails 2.1 Rails 2.2 regular expressions routing rss ruby security setup sql UI upgrading user management validation xml xml builder
Author Archives: Ashiq Alibhai
Regular Expressions in Ruby (and Rails)
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. Continue reading
Conditional Code
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 … Continue reading
Bort: Better Skeleton Applications
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)! Continue reading
Posted in Gems and Plugins
2 Comments
CSS Progress Bar
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. Continue reading
String Replacement in Ruby
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! Continue reading
Ruby Command-Line Arguments
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. Continue reading
Launchpad
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! Continue reading
Posted in Projects
Comments Off
Rails 2.1: Increment and Decrement Value
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.) Continue reading
Chaining Array Appends With <<
In Ruby, you can push an element to an array using the << method. This method returns the array, so you can chain appends using it, like so: a << "One" << "Two". Nice! Continue reading
Rails 2.1: Aggregate Expressions
Rails 2.1 allows you to perform complex aggregate queries, such as Donation.sum(“amount * 3″). This makes complex calculations a snap! Rails provides functions for calculating the average, count, maximum, minimum, and the sum. Continue reading