Ruby on rails ActiveAdminRecordNotFound
创业板成立后,我遇到了创业板的问题, 每当我试图使用管理面板更新、删除或创建帖子时,它就会抛出Ruby on rails ActiveAdminRecordNotFound,ruby-on-rails,activeadmin,friendly-id,Ruby On Rails,Activeadmin,Friendly Id,创业板成立后,我遇到了创业板的问题, 每当我试图使用管理面板更新、删除或创建帖子时,它就会抛出RecordNotFound 以下是app/controllers/post_controller.rb中的代码: class PostsController
RecordNotFound
以下是app/controllers/post_controller.rb中的代码:
class PostsController
从app/models/post.rb:
class Post < ActiveRecord::Base
belongs_to :category
attr_accessible :title, :slug, :blurb, :content, :category_id
scope :tarot, -> { where(category_id: 1) }
extend FriendlyId
friendly_id :title, use: :slugged
end
friendly_id :title, use: :slugged
class Post{where(category_id:1)}
扩展友好ID
友好的\u id:title,use::sluged
结束
那一刻就在app/models/post.rb中:
class Post < ActiveRecord::Base
belongs_to :category
attr_accessible :title, :slug, :blurb, :content, :category_id
scope :tarot, -> { where(category_id: 1) }
extend FriendlyId
friendly_id :title, use: :slugged
end
friendly_id :title, use: :slugged
应该是:
friendly_id :title, use: :[slugged, :finders]
错误堆栈跟踪?您可以从日志文件中获取。如有更多信息,将不胜感激。您是否删除并迁移了数据库?表中有slug列吗?是在该列中创建的友好id。我认为
extend-FriendlyId
部分应该位于类定义的第一行。是的,该表有一个slug列。