Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ActiveAdminRecordNotFound_Ruby On Rails_Activeadmin_Friendly Id - Fatal编程技术网

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列。