title: accessing the data from another model in ruby on rails
body: <p>I have 2 models named Subject &amp; Page. there is one to many association between them.</p>
  
  <pre><code>class Subject &lt; ActiveRecord::Base
  
    has_many :pages
    attr_accessible :name
    attr_accessible :position
    attr_accessible :visible
    attr_accessible :created_at
  end
  </code></pre>
  
  <p>and </p>
  
  <pre><code>class Page &lt; ActiveRecord::Base
  
    belongs_to :subject                                                    
     attr_accessible :subject_id
     attr_accessible :name
     attr_accessible :permalink
     attr_accessible :position
     attr_accessible :visible
     attr_accessible :created_at
  end
  </code></pre>
  
  <p>I have list.html.erb in view -> pages folder.</p>
  
  <p>Q. My qus is I want to show all the subject_id in list.html.erb. how?
  for that which changes I have to do in pages_controller &amp; list.html.erb so that I will got solution...</p>