Ruby on rails 3 链接到具有友好URL的资源

Ruby on rails 3 链接到具有友好URL的资源,ruby-on-rails-3,routes,Ruby On Rails 3,Routes,我想用Rails3写一个博客,所以我有帖子。我想为这样的帖子做一个不错的路线:帖子/年/月/日/帖子标题。因此,我在model/post.rb中重写了_参数,并使用友好的_id作为标题: extend FriendlyId friendly_id :title, :use => :slugged def to_param "#{year}/#{month}/#{day}/#{title.parameterize}" end 我将此添加到routes.rb: resources :p

我想用Rails3写一个博客,所以我有帖子。我想为这样的帖子做一个不错的路线:
帖子/年/月/日/帖子标题
。因此,我在
model/post.rb
中重写了_参数,并使用
友好的_id
作为标题:

extend FriendlyId
friendly_id :title, :use => :slugged

def to_param
  "#{year}/#{month}/#{day}/#{title.parameterize}"
end
我将此添加到
routes.rb

resources :posts do
  collection do
    match ":year/:month/:day/:id", :action => "show"
  end
  member do
    post 'comment'
    delete 'comment/:comment_id', :action => 'destroy_comment', :as => 'destroy_comment'
  end
end
show
中,此操作有效:

<%= link_to image_tag("/images/edit_icon.png"),            
    { :controller => 'posts', :action => 'edit' }, :id => @post %>
我是Rails新手,还没有找到导致此错误的原因。谁能帮我找出我做错了什么

routing error:
No route matches {:action=>"edit", :controller=>"posts"}.