@flyerhzm 来看看修正一下哇,估计是和我那个 mongoid_auto_increment_id 有冲突 Controller 里面调用就会有问题
class TopicsController < ApplicationController
def index
@topics = Topic.last_actived.includes(:node,:user).limit(15)
render :stream => true
end
end
Started GET "/topics" for 127.0.0.1 at 2011-11-23 22:15:03 +0800
Processing by TopicsController#index as HTML
MONGODB ruby_china_dev['topics'].find({:deleted_at=>nil}).limit(15).sort([["replied_at", :desc], ["created_at", :desc]])
MONGODB ruby_china_dev['nodes'].find({:_id=>{"$in"=>[8, 28, 2, 21, 1, 3, 23]}})
MONGODB ruby_china_dev['users'].find({:deleted_at=>nil, :_id=>{"$in"=>[2, 152, 3, 148, 92, 140, 1, 142]}})
Rendered topics/index.html.erb within layouts/application (42.2ms)
ActionView::Template::Error (undefined method `email' for #<Node:0x007fc8c86051b0>):
30: <% @topics.each do |topic| %>
31: <div class="topic topic_line">
32: <div class="pull-left avatar">
33: <%= user_avatar_tag(topic.user,:normal) %>
34: </div>
35: <div class="right_info">
36: <div class="pull-right replies">
/Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.1.1/lib/active_model/attribute_methods.rb:385:in `method_missing'
/Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:182:in `method_missing'
/Users/jason/work/ruby-china/app/helpers/users_helper.rb:31:in `user_avatar_tag'
/Users/jason/work/ruby-china/app/views/topics/index.html.erb:33:in `block in _app_views_topics_index_html_erb__3285293872487625280_70250171323080'
/Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/mongoid-eager-loading-0.3.1/lib/mongoid-eager-loading/mongoid/criteria.rb:12:in `each'
/Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/mongoid-eager-loading-0.3.1/lib/mongoid-eager-loading/mongoid/criteria.rb:12:in `each'
/Users/jason/work/ruby-china/app/views/topics/index.html.erb:30:in `_app_views_topics_index_html_erb__3285293872487625280_70250171323080'