On line 1 I have constructed an array of Event objects, which belong_to
an Account object. How might I construct an array of Account objects
from this array of Event objects on line 2?
1 notices = Event.find(:all, :conditions => [“account_id IN (?) AND name
= ?”, self.account_ids, account_notice_sent’])
2 return notices.account
You may want to add :include => ‘account’ to your Event.find to eager
load the accounts.
Peter M. wrote:
On line 1 I have constructed an array of Event objects, which belong_to
an Account object. How might I construct an array of Account objects
from this array of Event objects on line 2?
1 notices = Event.find(:all, :conditions => [“account_id IN (?) AND name
= ?”, self.account_ids, account_notice_sent’])
2 return notices.account