title: Rails 4 Mailer Uninitialized Constant
body: <p>I am trying to setup a mailer to where when a listing's available date is today, it will fire off a mailer. To do that, I am using <code>Date.today</code>. The other relevant code and error is below. Thanks in advance.</p>
  
  <p>availabke_date_mailer.rb</p>
  
  <pre><code>class ListingAvailableDateMailer &lt; ActionMailer::Base
  default from: "Nooklyn &lt;help@nooklyn.com&gt;"
  
    def listing_available_expire(listing, agent)
      @listing = listing
      @agent = agent
      mail to: "#{agent.email}", subject: 'Availability of your listing needs to be changed!'
    end
  end
  </code></pre>
  
  <p>listing_available_expire_notification.html.erb:</p>
  
  <pre><code>Hiya &lt;%= @agent.first_name %&gt;,&lt;br&gt;&lt;br&gt;
  
  The Available Date for your listing has passed. Please make the necessary changes.&lt;br&gt;&lt;br&gt;
  
  Listing: &lt;%= link_to @listing.short_address, @listing, target: "_blank" %&gt;&lt;br&gt;&lt;br&gt;
  Available Date: &lt;%= @listing.date_available %&gt;&lt;br&gt;&lt;br&gt;`
  </code></pre>
  
  <p>available_date.rake:</p>
  
  <pre><code>namespace :listings do
    desc "Send a message to an agent if the available date on their listing has passed"
    task listing_available_expire: :environment do
      Listing.all.each do |listing|
        if listing.date_available == Date.today   
          ListingAvailableDateMailer.listing_available_expire(listing,listing.listing_agent).deliver_now
        end
      end
    end
  end
  </code></pre>
  
  <p>Error:
  <a href="https://i.stack.imgur.com/GHITM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GHITM.png" alt="enter image description here"></a></p>