1
2
3
4
class Car < ActiveRecord::Base
  belongs_to :model
  has_many :photos
...

Ruby DRY it up please

by SoreGums, October 26, 2008 06:41, 6 refactorings, tagged with rails activerecord

This is a model.
my method...

D07cb7e4c1749e027447bd3b250c302f Talk
1
2
3
4
def all_shops(products)
    ids = []
    products.collect { |product| product.shops }.flatten.reject { |s| if ids.include?(s.id); true; else; ids.push(s.id); false; end }
...

Ruby Squash a collection.

by Eric, July 05, 2008 23:50, 3 refactorings, tagged with rails activerecord

The goal is to return a lis...

Fd1dab0af492d22ae0dc51d120a7c236 Talk