title: How do i access attributes in has_many :through relationship?
body: <p>How do i access store name here?@deal instance can access perfectly item name,but when i try to access store name it gives me </p>
  
  <pre><code>no method error 'stores'
  </code></pre>
  
  <p>How do i get store instance to access store name?Here is the code.Thank you in advance</p>
  
  <p>controller</p>
  
  <pre><code>def show
     unless session[:city_id].nil? || session[:city_id].blank?
     @city = City.find(session[:city_id])
     @deal=@city.deals
     @store=@deal.stores
  end
  </code></pre>
  
  <p>view/show</p>
  
  <pre><code>&lt;% @deal.each do |deal| %&gt;
  &lt;%=deal.item_name %&gt;
  &lt;%end%&gt;
  
  &lt;%=@store.store_name %&gt;
  </code></pre>
  
  <p>models</p>
  
  <pre><code>class Store &lt; ActiveRecord::Base
      has_many :deals ,:through =&gt;:store_deals
      has_many :store_deals
  end
  
  class Deal &lt; ActiveRecord::Base
      has_many :stores ,:through =&gt;:store_deals
      has_many :store_deals
  end
  
  class StoreDeal &lt; ActiveRecord::Base
      belongs_to :store
      belongs_to :deal
  end
  </code></pre>