Category Archives: General

Name Those Classes Properly

Although it may not seem intuitive, Rails is very picky when it comes to how you name your files, specifically  when adding new classes within your app folder.

Let’s say you have a class that looks like this:

class MySuperCatHelper

   def meow
      puts "Meow!!"
   end

end

You’ve saved this class in the app/helpers directory in a file called my_supercat_helper.rb. Naturally, you want this class to be available to your MySuperCat controller where you wish to add the following code:

cat = MySuperCatHelper.new
cat.meow

But for some reason, you’re getting an error about an uninitialized constant when using the above code in your MySuperCat controller.

Why is that?

Continue reading

Rake Tasks

With any web application, you will find yourself needing to run ‘behind-the-scenes’ tasks. In the .NET world, I often found myself writing scheduled tasks to run on app servers, or utilizing Taskie to accomplish these goals. But with Ruby on Rails, you’ll find yourself writing Rake tasks.

Continue reading

Tagged , ,