Ruby on Rails
Model Extensions

PreferenceFu Plugin

Gives you the ability to easily add large numbers of boolean attributes to your models without the need for more than one migration. Allows you to easily setup a basic ACL or user preferences.

Blog: http://www.brennandunn.com/2008/3/24/preferencefu
Github: http://github.com/brennandunn/preference_fu/tree/master

SMS Fu Plugin

This plugin allows you to send an SMS (text
message) to any cellphone, provided the phone
number and the carrier.
Read more…

Blog Post : http://brendanlim.com/2008/2/28/send-text-messages-from-rails-with-sms-fu
SVN : http://sms-fu.googlecode.com/svn/trunk/sms_fu
Github: http://github.com/brendanlim/sms-fu/

IsSearchable Plugin

This adds highly customizable search functionality to your models. Easily set up a custom query-based search for each model and create custom attribute filters for your search. Read more…

SVN : http://svn.behindlogic.com/public/rails/plugins/is_searchable/

EmailVeracity Plugin

This adds a validation function that you can use in models that have email attributes. It will validate email addresses three ways:

  1. Checks that the email address is well-formed
  2. Checks that the domain name in the email address has a DNS entry
  3. Checks that the DNS entry for the domain has an MX record

Blog Post : http://rails.savvica.com/2007/11/6/email-veracity-plugin
SVN : http://svn.savvica.com/public/plugins/validates_email_veracity_of/

Validates Constancy

This Rails plugin allows you to prevent particular database fields from being changed after a record is created. A validation error occurs on updates if an attribute of a model object is different from its value in the database.

HomePage : http://constancy.rubyforge.org/

SVN : http://constancy.rubyforge.org/svn/plugin/validates_constancy

Acts As Preferenced

acts_as_preferenced is an easy to use preference system for your application. Preferences can be key/value pairs or model associated preferences
(ex. User 4 has preference X for Thing 42) and even supports assoicated class preferences such as Employee 4 has preference ‘ignore’ on UserNotifier. Full test coverage included.

HomePage : http://webwideconsulting.com/plugins/acts_as_preferenced/
http://svn.webwideconsulting.com/plugins/

SVN : http://webwideconsulting.com/plugins/acts_as_preferenced/

Validate Attributes

validate_attributes is a really simple plugin to validate specific attributes of a model unlike the method valid? which collectively validates all the attributes. This plugin provides the functionality of validating specific attribute(s) and skipping others’ validations and vice versa.

HomePage : http://expressica.com/plugins/validate_attributes

SVN : svn://vinsol.com/plugins/sur/validate_attributes

Post a comment : click here

SimplyPresentable

Save keystrokes and stay DRY with SimplyPresentable:

< present!(foo).form do |f| >
  <= f.text_field :bar >
< end >

Instead of

<% form_for(
     foo.new_record? ? {
       :url => 'http://example.com/foos',
       :html => { :method => 'post', :id => 'new_foo', :class => 'new_foo' }
     } :
     {
        :url => "http://example.com/foos/#{foo.id}",
        :html => { :method => 'put', :id => 'foo_1', :class => 'foo' }
      } :
    ) do |f| %>
  <= f.text_field :bar >
< end >

SimplyPresentable is a plugin for that introduces the idea of presenters to rails

HomePage : http://simply_presentable.richcollins.net/

SVN : svn://richcollins.net/svn/simply_presentable

script/plugin install svn://richcollins.net/svn/simply_presentable

SimplyPresentable is fully tested as verified by rcov and heckle.

before_assignment?

class Approvable < ActiveRecord::Base
  belongs_to :approver,
             :class_name => 'User',
             :foreign_key => 'approver_id',
             :conditions => ['authorized_approver = ?', true],
             :extend => CheckApproverExtension  
end

module CheckApproverExtension
  def before_assignment(approver)
    raise UnauthorizedApproverException unless approver.authorized_approver
  end
end

svn:http://obiefernandez.com/svn/plugins/before_assignment

Simple Captcha

Simple Captcha provides the captcha authentication functionality in raubyonrails application. Its really simple to implement and it provides the multiple image styles to be displayed.

homepage:
http://expressica.com/2007/02/06/simple-captcha-released-the-captcha-for-rails-applications/

svn:
svn://rubyforge.org/var/svn/expressica/plugins/simple_captcha

API:
http://expressica.com/plugins/simple_captcha/doc

acts_as_classifiable

create_table :classifier_models, :force => true do |t|
      t.column :identifier, :int
      t.column :classifiable_type, :string, :null => false
      t.column :data, :blob
end

class Comment < ActiveRecords::Base
acts_as_classifiable :fields => ["text"], :categories => ["Spam", "Legit"]
end
@comment.train :legit

@comment.classify

description: http://cuttingtheredtape.blogspot.com/2006/05/actsasclassifiable.html

svn: http://opensvn.csie.org/sksinghi/acts_as_classifiable/

ActsAsNestedSet enhancement: BetterNestedSet

acts_as_slugable

For example, generate a URL slug based on the title of a Page record and store it in url_slug. Slug will be unique within the parent_id.

class Page < ActiveRecord::Base
        acts_as_slugable :source_column => :title, :target_column => :url_slug, :scope => :parent
    end

Whiny Finder Plugin

admin_controller.rb

def reset_password
  @user = User.find_by_login!(params[:id])
  @user.password = "changeme" 
  @user.save
  flash[:notice] = "#{@user.login}'s password was reset!" 
rescue ActiveRecord::RecordNotFound
  flash[:error] = "Could not reset user's password, unknown user." 
ensure
  redirect_to :action => 'index'
end

svn: http://soen.ca/svn/projects/rails/plugins/whiny_finder/trunk

sluggable_finder

A mix of acts_as_slugable and whiny_finder.

Installation:

script/plugin install http://code.estadobeta.com/plugins/sluggable_finder/

Simple to use.

Association Scope Plugin

post.rb

class Post < ActiveRecord::Base
  with_association_scope :order => "created_at DESC", :dependent => :delete_all do
    # Both of these are ordered by created_at
    has_many :posts
    has_many :comments
    # And yes we can override default behaviour
    has_many :milestones, :order => "priority" 
  end

  # Don't use created_at for this one
  has_many :projects
end

svn: http://soen.ca/svn/projects/rails/plugins/association_scope/trunk 404

Acts as Voteable Plugin

svn:
http://richcollins.net/svn/acts_as_voteable/

Improve the image quality and allow the random string images in the validates_captcha plugin

Acts As Rateable Plugin

RubyForge Project Page: http://rateableplugin.rubyforge.org/

svn: svn://rubyforge.org/var/svn/rateableplugin/trunk

Another Acts As Rateable Plugin

Just another one with the same functionality:

http://www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin/

acts_as_rated

Another rating plugin with a lot of customization options and the ability to cache total, count and average ratings per object, without the need to do count and avg calls on the ratings table.

Homepage: http://acts_as_rated.rubyforge.org

Repository: svn://rubyforge.org/var/svn/acts-as-rated/trunk/acts_as_rated

Acts As Taggable Plugin

be_taggable Plugin

Acts As Toucher Plugin

homepage:
http://www.crowdedweb.com/articles/2006/08/21/acts_as_toucher-ruby-on-rails-plugin

Acts As Priceable Plugin

homepage: http://orya.co.uk/articles/2006/04/10/acts_as_priceable-rails-plugin-its-here 404

svn: http://orya.co.uk/svn/acts_as_priceable/ 404

state_select Plugin

Usage:

homepage: http://webonrails.com/2006/09/12/plugin-state_select-generate-drop-down-selection-box-for-states/

Acts As Commentable Plugin

homepage: http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/

svn: http://juixe.com/svn/acts_as_commentable/

Acts As State Machine Plugin


http://lunchroom.lunchboxsoftware.com/articles/2006/01/21/acts-as-state-machine

Acts As Attachment Plugin

homepage: http://technoweenie.stikipad.com/plugins/show/Acts+as+Attachment

svn: http://svn.techno-weenie.net/projects/plugins/acts_as_attachment/

Acts As Dropdown Plugin

homepage: http://delynnberry.com/projects/acts-as-dropdown

svn: svn://delynnberry.com/code/plugins/acts_as_dropdown/trunk

Acts As Blog

homepage: http://www.recentrambles.com/pragmatic/view/63

svn: http://svn.recentrambles.com/plugins/acts_as_blog

Acts As Popular

Dollars And Cents

svn: http://svn.codahale.com/dollars_and_cents

Update has_and_belongs_to_many Attributes

Download: http://phpmywebmin.josh.ch/_uploads/j0sh/update_habtm_attributes_plugin.zip

File Column Plugin

homepage: http://www.kanthak.net/opensource/file_column/

svn: http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk

Active Form

homepage: http://www.realityforge.org/articles/2005/12/02/validations-for-non-activerecord-model-objects

svn: http://www.realityforge.org/svn/code/active-form/trunk/

Acts As Enumerated Plugin

svn: http://svn.protocool.com/public/plugins/enumerations_mixin/

Acts As Bitfield Plugin

homepage: http://gabriel.gironda.org/articles/2005/12/08/bitfields-in-activerecord

Acts As Gmail Account

homepage: http://rubyforge.org/projects/asgoogleaccount/

Acts As Urlnameable Plugin

homepage: http://gabriel.gironda.org/articles/2006/03/09/acts_as_urlnameable-released

Acts As Paranoid Plugin

homepage: http://ar-paranoid.rubyforge.org/

Acts As Threaded Plugin

homepage: http://www.railtie.net/articles/2006/02/05/rails-acts_as_threaded-plugin

Acts As Versioned Plugin

homepage: http://ar-versioned.rubyforge.org/
svn: http://svn.techno-weenie.net/projects/plugins/acts_as_versioned/

Acts as Formatted Plugin?

Acts As Deque Plugin

homepage: http://ar-deque.rubyforge.org/
svn: http://svn.dpiddy.net/plugins/acts_as_deque/

Acts As Auction Plugin

homepage:
http://adamjroth.com/articles/2006/07/23/rails-plugin-acts_as_auction 404

Acts As Shellable Plugin

homepage: http://www.chwhat.com/projects/shellable

Acts As Activated Plugin

svn: http://svn.webwideconsulting.com/svn/acts_as_activated/

Acts As Favorite Plugin

svn: http://svn.webwideconsulting.com/svn/acts_as_favorite/

Custom XML Serialization

Customize the XML serialization of your model objects. The following code:

class Widget < ActiveRecord
  belongs_to :factory
  has_many :sprockets
  xml_serialize [ :name, { :factory => [ :name, "factory" ] } ]
  xml_serialization_options :factory, :cdata => true
  xml_serialization_options :sprockets, :name=> 'components'
end
Widget.find(:first).to_xml

will produce:

  <widget>
    <name>Hydromatic Conflagulator</name>
    <factory><![CDATA[John's Factory o' Conflagulation]]></factory>
    <components>
      <sprocket>
        <name>Whatchamacallit</name>
        <amount>17</amount>
       </sprocket>
    </components>
  </widget>

installation:

svn co http://custom-xml-serialization.googlecode.com/svn/branches/1.0 vendor/plugins/custom_xml_serialization

Uses Guid Plugin

homepage: http://tools.assembla.com/breakout/wiki/FreeSoftware

svn: http://tools.assembla.com/svn/breakout/breakout/vendor/plugins/guid

Enforce Column Limits Plugin

homepage: http://rubyforge.org/projects/enforce-limits/

Annotate Models

svn: http://svn.pragprog.com/Public/plugins/annotate_models

OpenLaszlo Plugin

homepage: http://laszlo-plugin.rubyforge.org/

Userstamp Plugin

homepage: http://delynnberry.com/projects/userstamp/

Spatial Adapter

homepage:
http://thepochisuperstarmegashow.com/projects/#spatialadapter

svn (works for both MySql and PostGIS) :
svn://rubyforge.org/var/svn/georuby/SpatialAdapter/trunk/spatial_adapter

Validator Plugin

homepage: http://rubyforge.org/projects/validator/

Validates_URL

svn co http://validates-url.googlecode.com/svn/branches/1.0 vendor/plugins/validates_url

HTTP URL Validation Improved

svn co https://modzer0.cs.uaf.edu/repos/hank/code/http_url_validation_improved

./script/plugin install -x https://modzer0.cs.uaf.edu/repos/hank/code/http_url_validation_improved

HTTP URL Validation Plugin

homepage: http://www.ccjr.name/blog/2006/01/25/http-url-validator

Valid XML

homepage: http://www.johnwulff.com/articles/2006/10/03/xml-validation-plugin

svn: http://validates-xml.googlecode.com/svn/trunk

validates_unlike plugin

homepage: http://www.lacaraoscura.com/2006/07/11/validates-unlike-plugin/

Enhanced ActiveRecord Errors

homepage:
http://railtie.net/articles/2006/01/26/enhancing_rails_errors

Validates Numericality Of

homepage:
http://www.railtie.net/articles/2006/01/27/defining-numericality

Custom Error Message

homepage: http://rubyforge.org/projects/custom-err-msg/

Auto Escape Plugin

homepage:
http://rubyforge.org/projects/autoescape/

svn:
svn://rubyforge.org//var/svn/autoescape

CAPTCHA Validation Plugin

svn: http://svn.2750flesk.com/plugins/trunk/validates_captcha

Acts as HABTM List

homepage: http://www.inlet-media.de/acts_as_habtm_list

svn: http://svn.inlet-media.de/svn/rails_extensions/plugins/acts_as_habtm_list

Riff Plugin

svn: http://tfletcher.com/svn/rails-plugins/riff/

ForceUppercase Plugin

svn: svn://rubyforge.org//var/svn/force-uppercase

Acts as Ordered

readme: http://svn.viney.net.nz/things/rails/plugins/acts_as_ordered/README

svn: http://svn.viney.net.nz/things/rails/plugins/acts_as_ordered

Validates Date Time

readme: http://svn.viney.net.nz/things/rails/plugins/validates_date_time/README

svn: http://svn.viney.net.nz/things/rails/plugins/validates_date_time

Validates Elfproef

download:
http://www.spacebabies.nl/elfproef/

validates_email_format_of

Validate email addresses against RFC 2822.

Takes the same options as validates_format_of

class Person < ActiveRecord::Base
   validates_email_format_of :email
end

Description: http://multi-up.ca/code/

README: http://code.dunae.ca/validates_email_format_of/README

SVN: http://code.dunae.ca/validates_email_format_of/

Validates As Email

readme:
https://svn.greenpeace.org/repositories/rails_plugins/validates_as_email/tags/0.1.4/README

svn:
https://svn.greenpeace.org/repositories/rails_plugins/validates_as_email/tags/0.1.4

SQL Decimal Support

tarball: http://www.ashleymoran.me.uk/sql_decimal_support.tgz

Pessimistic Locking Plugin

svn: http://projects.netlab.jp/svn/rails_plugins/pessimistic_locking

HABTM Create Fix

svn: http://svn.hasmanythrough.com/public/plugins/habtm_create/

Allow HABTM Primary Key Plugin

svn: svn://suven.no-ip.org/rails/plugins/allow_habtm_primary_key
file: http://suven.no-ip.org/allow_habtm_primary_key.tar.gz

ModelFormatter

  format_column :sale_price, :as => :currency

svn: https://hattenschwetter.com/svn/hattenschwetter/rails_plugins/model_formatter/trunk

Nested Transactions

homepage: http://rubyforge.org/projects/arnesttransacts

svn: svn://rubyforge.org/var/svn/arnesttransacts/trunk

Validates Multiparameter Assignments

file: http://www.kbmj.com/users/shinya/rails/validates_multiparameter_assignments-1.0.zip

multiparameter_arrays?

Foreign Key Schema Dumper Plugin

svn: svn://caboo.se/plugins/atmos/activerecord_foreign_key_extensions

Validation Reflection

http://www.schuerig.de/michael/rails/validation_reflection

Asynchronous Method Calls?

class TestRecord < ActiveRecord::Base

  after_save :an_alert

  def an_alert
    logger.info "We could now asynchronously send an email to tons of people with this alert." 
  end
  asynchronous :an_alert
end

svn: http://asynchronous.googlecode.com/svn/trunk/asynchronous/

homepage: http://code.inklingmarkets.com/asynchronous-rails-plugin/

Acts as Most Popular

svn: http://shanesbrain.net/svn/rails/plugins/acts_as_most_popular

Acts As Textiled

homepage: http://errtheblog.com/post/14

svn: svn://errtheblog.com/svn/plugins/acts_as_textiled

Acts As Cached

homepage: http://errtheblog.com/post/27

svn: svn://errtheblog.com/svn/plugins/acts_as_cached

list: http://groups.google.com/group/acts_as_cached

Acts As Configurable

homepage: http://svn.nkryptic.com

svn: http://svn.nkryptic.com/plugins/acts_as_configurable

Acts As Bytefield

homepage: http://blog.cbciweb.com/articles/2007/04/23/acts-as-bytefield-activerecord-bytefield-plugin

svn: https://svn.cbciweb.com/svn/plugins/acts_as_bytefield

has_many_polymorphs

selection_options_for

Manages hard-coded selection lists.
Allows you to

svn: http://railsstudio.com/svn/pub/plugins/selection_options_for/trunk/selection_options_for

 
 

Acts As Disjoint Set

Puts objects (rows) into a disjoint set data structure, which allows the efficient (constant amortised time) merging of rows into disjoint sets. Use this plugin if you have a large number of rows, and you want to group them into sets by a series of merges.

svn:
svn://rubyforge.org/var/svn/actsdisjoint/plugins/acts_as_disjoint/trunk

acts_as_shareable

Rails plugin to allow sharing of one model object to another (share ‘rails cookbook’ to the ‘rails reading group’). Adds a number of methods to help find the objects that are shared, etc.

svn:svn://rubyforge.org/var/svn/actsasshareable

seo_urls

Overwrites to_param to append a url-friendly version of the model’s ‘name’ or ‘title’ attribute to it’s id. Useful for increasing search engine visibility of nested pages in your site.

SVN : http://svn.redshiftmedia.com/svn/plugins/

acts_as_taskable

Acts as Taskable is a Rails plugin that allows any ActiveRecord class to automatically accept tasks

svn:http://acts-as-taskable.googlecode.com/svn/trunk/acts_as_taskable

Acts As Resource

ActsAsResource combines ActiveRecord and ActiveResource features in one class.

http://dev.23labs.net/svn/rails/plugins/acts_as_resource/

slugger

With Slugger you can use a field(s) of the model as a slug (URL friendly version of the record). So instead of controller/id you can use controller/slug (http://example.com/posts/1 => http://example.com/posts/my-post-title)

Home : http://www.jesuscarrera.info/proyectos/slugger/

SVN: http://svn.jesuscarrera.info/slugger