Skip to content

Instantly share code, notes, and snippets.

@anathematic
Created April 19, 2010 15:56
Show Gist options
  • Save anathematic/371203 to your computer and use it in GitHub Desktop.
Save anathematic/371203 to your computer and use it in GitHub Desktop.
@contracts = Contract.find(:all,:joins =>'inner join sites on sites.id = contracts.site_id inner join cities on cities.id = sites.city_id inner join states st on st.id = cities.state_id inner join countries c on c.id = st.country_id', :conditions => ['deleted = 0 and sites.site_status_id <>3 and (contracts.end_date - current_date)< 240 and (contracts.end_date - current_date) > 0 and contracts.end_date is not null and c.id in (%s)', current_user.contact.country_ids_by_rights("sites","edit").join(",")], :order=>'contracts.end_date asc')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment