AR Delegation plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install svn://rubyforge.org/var/svn/ar-delegation
Plug-in time! Wouldn’t it be nice to do something like this?
class Person < ActiveRecord::Base belongs_to :company has_columns :from => :company, :except => "id" end
and get a fully nil safe set of delegated methods out of it so you can just call the fields like they belong to the model doing the delegation.
Hopefully these other examples will be self explanatory as to what this little plug-in can do:
has_columns :from => :source, :except => "id" has_columns :from => :source, :only => [ "title", "name" ], :prefix => "src_" has_column :col_name, :from => :source, :as => :new_name has_column :col_name, :from => :source
It does allow fields to be prefixed which might be useful if you are bringing in fields from multiple other models or would just like to prefix the fields.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago

