Association Scope plugin

Plugin details

Allows scoping of association definitions.

Repositoryhttp://soen.ca/svn/projects/rails/plugins/association_scope/ Tags association, scope LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install http://soen.ca/svn/projects/rails/plugins/association_scope/
  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

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 7 months ago