title: rails 3.0.3 - ActiveRecord::Relation, undefined method error
body: <p>I am having this unexplained ActiveRecord::Relation, undefined method error . I don't know why, since my model association are well defined and the event table has the foreign keys for the user table. I tried using this fix but it failed: <a href="https://stackoverflow.com/questions/4522288/rails-3-activerecordrelation-random-associations-behavior">Rails 3 ActiveRecord::Relation random associations behavior</a> </p>
  
  <h1>event.rb</h1>
  
  <pre><code>class Event &lt; ActiveRecord::Base
    belongs_to :user
  
    attr_accessible :event_name, :Starts_at, :finish, :tracks
  end
  </code></pre>
  
  <h1>user.rb</h1>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :events, :dependent =&gt; :destroy
  
    attr_accessible :name, :event_attributes
  
    accepts_nested_attributes_for :events,  :allow_destroy =&gt; true
  
  end
  </code></pre>
  
  <h1>schema.rb</h1>
  
  <pre><code>ActiveRecord::Schema.define(:version =&gt; 20101201180355) do
  
    create_table "events", :force =&gt; true do |t|
  
      t.string   "event_name"
      t.string   "tracks"
      t.datetime "starts_at"
      t.datetime "finish"
      t.datetime "created_at"
      t.datetime "updated_at"
      t.integer  "user_id"
    end
  end
  </code></pre>
  
  <h1>error message</h1>
  
  <pre><code>NoMethodError in Users#index 
  undefined method `events' for #&lt;ActiveRecord::Relation:0x4177518&gt;
  
  Extracted source (around line #10):
  
  7:  &lt;th&gt;&lt;%= sortable "Tracks" %&gt;&lt;/th&gt;
  
  8:   &lt;/tr&gt;
  
  
  10:  &lt;% @users.events.each do |event| %&gt; 
  
  11: &lt;% debugger %&gt; 
  
  12:   &lt;tr&gt;
  
  13:     &lt;td&gt;&lt;%= event.starts_at %&gt;&lt;/td&gt;
  
  Trace of template inclusion: app/views/users/index.html.erb
  
  Rails.root: C:/rails_project1/events_manager
  Application Trace | Framework Trace | Full Trace
  
  app/views/users/_event_user.html.erb:10:in `_app_views_users__event_user_html_erb__412443848_34308540_1390678'
  app/views/users/index.html.erb:7:in `_app_views_users_index_html_erb___603337143_34316016_0'
  </code></pre>