Guest User

Untitled

a guest
Apr 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. class Job < ActiveRecord::Base
  2. # each job has several related "workflow" records, one of which has a :name of "Ship" and a :completed bool
  3. # 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.
  4. named_scope :not_shipped, lambda { not_shipped }
  5.  
  6. def not_shipped
  7. Workflow.find(:all, :conditions => {"job_id = ?" => self, "name = ?" => "Ship", "completed = ? " => false } )
  8. end
  9.  
  10. end
Add Comment
Please, Sign In to add comment