Skip to content

Instantly share code, notes, and snippets.

@MikeHibbert
Created November 21, 2013 10:09
Show Gist options
  • Save MikeHibbert/7579092 to your computer and use it in GitHub Desktop.
Save MikeHibbert/7579092 to your computer and use it in GitHub Desktop.
@suggested_companies = []
while @suggested_companies.count != 6
@random_industry = Industry.first(:offset => rand(Industry.count)) # Industry.all.choice
@suggested_companies = AssociatedIndustry.where("source_type = 'Company' and industry_id = #{@random_industry.id}").limit(6).first.source # .collect(&:source)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment