Posts Tagged ‘Rails Plugins’

Ruby on Rails Best Coding Practices Slide Show and Gem

Posted on the November 17th, 2009 under Ruby on Rails by

When browsing around today I saw quite a few sites talking about the Rails Best Practices presentation / talk that ihower did at the Kungfu RailsConf. Check it below, it really covers a lot of basic tips on how to clean up your code and follow some better coding practices.

Someone just released a gem that will analyze your code and check for “Best Practices” –  seems promising. Check it out at GitHub here:

Acts As Taggable on Steroids Ruby On Rails Plugin With Paginate

Posted on the October 8th, 2008 under My Projects,programming,Ruby on Rails by

Acts As Taggable On Steroids is a great plugin for Rails that makes adding tags to your application quick and easy. Check it out on github here =>

I threw this post together with some notes that I took along the way when setting up the plugin for use.


script/plugin install


Setup your migration by running the below:

ruby script/generate acts_as_taggable_migration
rake db:migrate

Add the acts_as_taggable to your model, in my case its the Events model…

class Event < ActiveRecord::Base
# acts as taggable on roids

Now I needed to add a way to allow tags to be added to Events, in my form for my Event I added the following:

  <%= f.label 'Tag List (Delimiter = ,)' %><br />
  <%= f.text_field :tag_list %>

To view the tags associated this a Event on the Show page, along with linking to the actual tag to search for other events tagged with the same item, I added the following:

<p><strong>This event was tagged with</strong>: <% for tag in @event.tags %> 
<%= link_to, events_path(:view =>'tag', :tag => %><% end %>

Tag Clouds

In order to use the plugin’s build in tag cloud functionality you need to add the helper to your application helper by doing the following:

  module ApplicationHelper
    include TagsHelper

In your controller where you are planning on using your tag cloud add the below, this will grab the counts of all your tags so the helper can generate your cloud. Again in my case I am putting this in my Events controller.

@tags = Event.tag_counts

Now you use the following where you wish to show your views:

<% tag_cloud @tags, %w(tag1 tag2 tag3 tag4) do |tag, css_class| %>
    <%= link_to, { :action => :tag, :id => }, :class => css_class %>
  <% end %>

In your main CSS file you should add something to match the tags we specified above, this sets your font sizes for the cloud display generated by the helper…

  .tag1 { font-size: 1.0em; }
  .tag2 { font-size: 1.6em; }
  .tag3 { font-size: 2.7em; }
  .tag4 { font-size: 3.8em; }

Tag Clouds with Paginate Example

Here I am passing the page and tag to my events model to find all events tagged with that tag, and then use the results of that query and passing it onto paginate.

def self.tag_event_list(page, tag)
 options = Event.find_options_for_find_tagged_with(tag).merge :page => page, :per_page => 10, :order => 'date DESC' 

Other Notes:

I added the following to my environment.rb file so that the unused tags get destroyed if they are no longer in use by any events.

# automatically remove dead tags
Tag.destroy_unused = true

For more help check out the read me here:

A few great plugins that I am using in my current Ruby on Rails project

Posted on the October 6th, 2008 under My Projects,programming,Ruby on Rails,Tutorials by

I am currently working on an interesting project for a customer of mine.   Hopefully I’ll be able to share more of the details with you all when the project is near completion.  The project involves creating events, parsing and caching RSS feeds, generating RSS feeds, as well as Emailing and SMS’ing subscribers daily events.   I have been working on the project for the last 5 days, and I am about one third of the way through.

I wanted to share some great plugins for Ruby on Rails that I have come across, along with some tutorials. Check back for an updated post with more info.


Restful Authentication – This widely-used plugin provides a foundation for securely managing user authentication –

acts_as_taggable_on_steroids – This plugin is based on acts_as_taggable by DHH but includes extrassuch as tests, smarter tag assignment, and tag cloud calculations.  –

Paperclip – Paperclip is intended as an easy file attachment library for ActiveRecord. The intent behind it was to keep setup as easy as possible and to treat files as much like other attributes as possible.

Paperclip Polymorph – This plugin allows users of the Paperclip plugin to easily share attached files between multiple models.

acts_as_textiled – This simple plugin allows you to forget about constantly rendering Textile in your application. Instead, you can rest easy knowing the Textile fields you want to display as HTML will always be displayed as HTML (unless you tell your code otherwise).

Will_paginate – Pagination is just limiting the number of records displayed. Why should you let it get in your way while developing, then? This plugin makes magic happen.

Tutorials / Guides:

If you are new to Ruby on Rails be sure to check out the guides that are being worked on right now here:

Railscasts – Free Ruby on Rails Screencasts –

Learning Rails – Audio (Podcasts) and Screencasts –

Jim created a great list of plugins he found useful when he was building a social network in Rails. Check it out here: