Ruby on Rails Tips

Home Ruby on Rails Tips

Use Ruby’s ‘autoload’ instead of ‘require’ for your Ruby and Rails Apps

When googling to find the answer to a ruby (or rails) coding problem, it struck me that code snippets always use “require” to include any necessary libraries. For example, I recently searched for a way to compare IP addresses using

Why Your Controller Methods Should be Private

Most of your controller methods are public actions that display pages on your website. Your app’s routes will point to these methods and show the corresponding page (view). For example: But hopefully you are keeping things modular and breaking up

How to automagically get friendly URLs in Rails 3

By default, Rails uses ID’s in URLs. For example, let’s say we have a list of categories stored in the categories table of the database. The “Super Cool” category is stored with categories#id = 5. To view that category our