Created
February 7, 2012 21:45
-
-
Save canweriotnow/1762280 to your computer and use it in GitHub Desktop.
Chaining scopes for milt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Issue < ActiveRecord::Base | |
named_scope :tasks, :conditions => {:tracker_id => 7} # if the id of the Tasks tracker is 7, natch | |
named_scope :open, :conditions => {:status_id => 1} # assuming 'Open' == 1 | |
end | |
# Then in your controller action: | |
@my_issue = Issue.open.tasks.find_by_assigned_to_id(User.current.id) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment