4 1/2 Rails plugins I use in every project

Any time I’m starting a Rails project, I pick which base plugins I’m going to need to get the job done. Here are the ones I use the most.

SQL Session Store

This is Stefan’s implementation of the SQL session store bypassing ActiveRecord for performance. Wasting cycles on loading the session is not what I want my servers to be spending their time on.

Exception Notification

We all want to know when our production servers are having problems. The Exception Notification plugin sends you mail when exceptions occur. One note: Routing errors are not caught by this plugin, which may be important for you to catch.

Acts As Slugable

Put the title of your model into the URL for that model, not just its ID. This is great for SEO purposes, and is easier to read when looking at urls.

Obie just wrote about how to do this manually

Action Cache

Shameless plug! You can’t run a production web site without some sort of caching of page results. Page caching is the best, if your site has pages that can use this form of caching. Action caching is the next best, and my action_cache plugin extends the functionality of action caching (and works around bugs that can be annoying)

Acts As Authenticated

Not really a plugin, once the Acts As Authenticated generator has been run, the plugin can be deleted (hence the 1/2). The generated code has issues when you start adding extra functionality from the wiki, but the basics get you going pretty quickly.

Posted by Tom Thu, 08 Feb 2007 04:27:24 GMT


2 Best Firefox plugins for Rails developers

Usually these lists are 10 best, but really, for Rails developers, there are only two plugins you really need.

DevBoi plugin, with Rails addon

The DevBoi plugin adds a sidebar with documentation lookup for HTML, CSS, DOM and Javascript.

The Rails addon pack gives you Rails and Ruby documentation too. Ctrl-F9 (on Windows) brings up the sidebar.

I can’t work without this plugin.

Install it from here: http://www.martincohen.info/products/devboi/

Web Developer plugin

This plugin allows you to view all sorts of useful information about the current page. When you’re building pages, and nothing seems to be working, the information this plugin provides is invaluable.

Get the Web Developer plugin here: https://addons.mozilla.org/firefox/60/

Posted by Tom Mon, 05 Feb 2007 05:38:38 GMT


Dreamhost, Rails and locally installed Gems

I followed the instructions for installing Collaboa on Dreamhost, which includes building and installing local versions of everything interesting – Rails, Subversion, FastCGI, Gems.

The environment can be setup in the .bash_profile, .bashrc and .gemrc files to allow all the tools find these locally installed versions. .bashrc is claimed to be the place for non-interactive apps to get their configuration setup. It seems not, at least for the Dreamhost configuration.

After trying all the tricks in the book to get my Rails app running under FastCGI, I eventually worked out what was missing—my app wasn’t picking up the locally installed Gems.

To make this work, I added the following lines to my dispatch.fcgi file:

ENV['RAILS_ENV'] = 'production'
ENV["GEM_HOME"]="/home/<username>/.gems"
ENV["GEM_PATH"]="/usr/lib/ruby/gems/1.8:/home/<username>/.gems"

After killing the existing processes, my app started working as expected. Woot!

I also added Todd’s new Dreamhost Plugin to the app to help improve reliability.

Posted by Tom Sat, 03 Feb 2007 08:39:31 GMT


Where'd my job go?

The company I work for just went into ‘hibernation mode’, so we’re all out of work, at least temporarily, maybe permanently.

I’ve updated my entry on WorkingWithRails.com to show my new-found availability, and am waiting for the offers to come flying in!

tom@craz8.com will get you in touch with me, if you need a Rails programmer to do work on short notice.

Posted by Tom Thu, 01 Feb 2007 00:04:18 GMT


Why is my code in a loop?

Today, I wrote some code that looked a little bit like this:

class Model < ActiveRecord::Base

  ...

  def update
    RAILS_DEFAULT_LOGGER.info "Update Called"
    # Read some data from wherever
    # Set some properties on my object
    save!
  end
end

Imagine my surprise when my log output was a long stream of Update Called lines.

What happened here is that save is implemented as a call to update when the object already exists.

Inadvertently picking a method name that is the same as an important Rails method can be hard to track down. I already had my logging in there, so I wasn’t left wondering why the call never completed.

Posted by Tom Thu, 25 Jan 2007 04:09:42 GMT


Start the weekend with a boat rescue!

Lisa and I just had a ‘Joe and Petunia’ moment.

I noticed a small boat in trouble just off shore from the Kirkland marina today. The boat just stopped and they started waving an orange flag – they also started bailing. Lisa called 911.

Before the rescue boat arrived, the boat in trouble drifted into the docks at the North end of Marina Park and the two gentlemen rescued themselves.

Living on the lake provides so much entertainment.

Posted by Tom Sat, 20 Jan 2007 21:29:47 GMT


View your Divx videos on your Xbox 360

I just installed TVersity to do on the fly transcoding of Divx videos for my XBox 360. The key is to have the correct versions of all the other software. Here is a post about how to do this

This is way easier to setup than the Media Connect software that Microsoft ships.

My server is a dual core 2.8 GHz monster machine (from 18 months ago!). TVersity uses 100% of both cores to transcode my videos.

The videos I’ve watched so far actually look really good – not Hi Def, but pretty good. Certainly not good enough to be confused with HD

Posted by Tom Fri, 19 Jan 2007 04:11:10 GMT


Low memory spam reduction using Greylisting

In my search for reducing memory usage on my OpenVZ VPS, I took a look at my email server configuration. I originally used the configuration instructions from Howto Forge to setup my server. Even with adjusting the configuration, the memory used by all the mail components, especially the protection system – Spamassassin, ClamAV and the pieces necessary to run them – was over 100MB.

However, if I remove this protection, bad stuff will get through!

What about greylisting, I thought.

In summary, a server that performs greylisting denies the first incoming mail request. Any regular SMTP server will retry the request later, and this request will be allowed through. Spammers use custom software that usually doesn’t retry, they just move on to the next email in their list. Regular mail gets through with a delay the first time and spam is effectively blocked.

I uninstalled all the postfix add-ons I’d added-on, and used apt-get install postgrey to add greylisting to Postfix on my server.

Some spam still gets through, but 90% is gone. I use Thunderbird to access my email account here, and this detects the junk mail very well (actually better than my install of Spamassassin did).

Greylisting works better than I thought it would, and the best part is that the server uses less than 12MB of my precious OpenVZ memory allocation

Posted by Tom Wed, 17 Jan 2007 06:15:33 GMT


acts_as_taggable is dead, long live has_many_polymorphs

Evan Weaver has just posted about how to replace all the different acts_as_taggable implementations with his has_many_polymorphs plugin.

Since the current owners of the acts_as_taggable gem seem to have abandoned it, and DHH’s identically named acts_as_taggable plugin also seems dead, this is probably the best way forward if your writing new code or planning changes to old code in the near future.

I haven’t checked this out yet, but my tag cloud code should be able to work with has_many_polymorphs with little to no modification.

Posted by Tom Sun, 14 Jan 2007 06:12:49 GMT


Karma sucks when you lose your hard disk!

I’ve been giving Ben grief most of the week because his Mac laptop was in the shop (and is now on its 3rd motherboard).

2pm Friday, my laptop hard disk just stops working! Not readable in any way.

Karma!

Some things lost, but the main hassle is installing everything from scratch.

Posted by Tom Sat, 13 Jan 2007 03:53:04 GMT


Older posts: 1 2 3 4 5 ... 17