title: Sending account users daily e-mails with site updates Ruby on Rails
body: <p>I am trying to set something up in my app where a daily e-mail is sent out to all users with the news posts created for their account each day.</p>
  
  <p>I already have the CRON task setup, but I don't know enough about ActionMailer to figure out how to send specific info to each user... </p>
  
  <p>In my app, Users belong to accounts, accounts have many users, and users have many ideas and accounts have many ideas through users. </p>
  
  <p><strong>So if Account 1 has 3 users, Every day I want all three users to receive the new ideas in the last day via e-mail.</strong> </p>
  
  <p>I know this is complicated, but if anyone can help with a starting point it would be greatly appreciated.</p>
  
  <p>Cheers</p>
  
  <p>edited to include code from model:</p>
  
  <pre><code>    class Account &lt; ActiveRecord::Base
      has_many :users
      has_many :ideas, :through =&gt; :users
  
      class User &lt; ActiveRecord::Base
      belongs_to :account
      has_many :ideas, :dependent =&gt; :destroy
  </code></pre>
  
  <p>I basically want to send this feed from the index page to each user in a daily e-mail:</p>
  
  <pre><code>    &lt;strong&gt;Here are some of your colleagues recent ideas:&lt;/strong&gt;
      &lt;% @ideas.each do |idea| %&gt; #@ideas = Account.ideas
      &lt;% if idea.created_at &gt; 4.hours.ago %&gt;
      &lt;table class="microposts" summary="User microposts"&gt;
      &lt;tr&gt;
      &lt;td class="micropost"&gt;
  &lt;span class="ideatitle"&gt;&lt;%= idea.title %&gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span class="ideacontent"&gt;&lt;%= idea.content %&gt;&lt;/span&gt;
      &lt;span class="timestamp"&gt;
      Conceived &lt;%= time_ago_in_words(idea.created_at) %&gt; ago.
      &lt;/span&gt;
      &lt;/td&gt;
      &lt;td&gt;
  </code></pre>
  
  <p>Thanks again!</p>