Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
Working PS3 Jailbreak 3.65 And 3.66
ExtaBit Premium Accounts and Cookies
Steam Wallet Hack - Money Adder & Hack v3
Empires & Allies Hack Cheat Trainer v5.4.1
Eve Onnline 60 Days Time Card Generator v2
Xbox Lve Generator v3
Better way to get content via jQuery $.get()
Free CarTown Blue Points Generator and CarTown Templates
Steam Wallet Hack 2012
Diablo 3 error 37 & error 3006 fix
Popular
XBOX POINTS GENERATOR - MICROSOFT POINTS GENERATOR v1.2012
11 may 2012 premium uploading accounts 100% working
Free Microsoft Points
Free Microsoft Points - Microsoft Points Generator - Xbox Live Codes 2012
Car Town Free Blue Points Hack
Free CarTown Blue Points Generator and CarTown Templates
Free Microsoft Points
Simple Days Purger
Sharecash Downloader Bypass Surveys New 05/2012
PAYPAL REMOVE ACCESS LIMITED ACCOUNT 100% Working
Pastable version of
Find records according to related model
<pre class='prettyprint' language='ruby'># link_categories has_many links create_table "link_categories", :force => true do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" end create_table "links", :force => true do |t| t.string "label" t.string "address" t.text "description" t.integer "link_category_id" t.datetime "created_at" t.datetime "updated_at" t.string "logo_file_name" t.string "logo_content_type" t.integer "logo_file_size" t.datetime "logo_updated_at" end # the method i would like to optimize: def self.all_with_logo categories = all ret_categories = [] categories.each do |linkcategory| links = [] linkcategory.links.each do |link| if link.logo_file_name links << link end end if links.length > 0 ret_categories << linkcategory end end ret_categories end</pre> <a href="http://www.refactormycode.com/codes/1379-find-records-according-to-related-model" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>