views:

11

answers:

0

This is a simple issue but I have multiple cases in my populate file where I want to set order.link_id to any link where link.job_id = j.id.

Order.populate 1 do |order|
  @links = Link.find_all_by_job_id(j.id)  
  order.link_id = @links.find(:first, :offset => rand(@links.count)).id
  ...
end

This produces an error (2 arguments for 1 on find). It runs when doing the exact same thing on the Link table (instead of @links). How can I get this code to work such that I get my selectively random file?