ROR新动作错误无法找到ID = nexttwentyfive的帖子

时间:2011-03-04 23:50:46

标签: ruby-on-rails resources conditional-statements

我认为我的操作是帖子ID时出错?

网址http://localhost:3000/posts/nexttwentyfive?lastid=1

def nexttwentyfive
  @posts = Post.find(:all, :order => "date", :limit => 25, :conditions => ["id=? AND created_at > ?", Time.now, params[:lastid]])

  respond_to do |format|
   format.html
   format.xml  { render :xml => @post } 
   format.json { render :json => @post }
 end
end 

map.resources :posts, :collection => { :nexttwentyfive => :get  } 

1 个答案:

答案 0 :(得分:0)

我会按照@macarthy的建议重启服务器/检查路线。

您收到的错误显示下一条五条路线未被识别为收集,并且正在处理为/ posts /:id