This repository has been archived by the owner on Oct 9, 2019. It is now read-only.
allows the usage of scopes from a relation's models for filtering
License
zacheryph/relational_scope
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
!!! 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
About
allows the usage of scopes from a relation's models for filtering
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published