Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Job < ActiveRecord::Base
- # each job has several related "workflow" records, one of which has a :name of "Ship" and a :completed bool
- # I want my index.html.erb for job to only show those jobs who's related workflow record with :name == "Ship" and :completed == false to show up.
- named_scope :not_shipped, lambda { not_shipped }
- def not_shipped
- Workflow.find(:all, :conditions => {"job_id = ?" => self, "name = ?" => "Ship", "completed = ? " => false } )
- end
- end
Add Comment
Please, Sign In to add comment