Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
allows the usage of scopes from a relation's models for filtering
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/suid_bit
test
MIT-LICENSE
README
Rakefile
init.rb

README

!!! PLEASE DO NOT USE RELATIONAL_SCOPE !!!
__________________________________________

i have not updated relational_scope since i created it.
If you are looking for something similar try searchlogic:

    http://github.com/binarylogic/searchlogic


RelationalScope
===============

This plugin makes it possible to filter a specific model using the
named_scope's of one of its relations.  This prevents making duplicate
named_scopes in multiple models.


Example
=======

class Post < ActiveRecord::Base
	belongs_to :author

	has_relational_scope :author, :prefix => 'a'
end

class User < ActiveRecord::Base
	named_scope :admins, :conditions => {:admin => true}
end

In your Controller you can go:

@posts = Post.a_admins

This will fetch all and only posts where the author is an admin.

Without the :prefix option this would be called as Post.author_admins


Copyright (c) 2009 Zachery Hostens, released under the MIT license
Something went wrong with that request. Please try again.