Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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
View “我该怎么做?”;unscope“;Rails 3中的编辑路径和/或操作?_View_Controller_Ruby On Rails 3.2_Default Scope_Url Helper - Fatal编程技术网

View “我该怎么做?”;unscope“;Rails 3中的编辑路径和/或操作?

View “我该怎么做?”;unscope“;Rails 3中的编辑路径和/或操作?,view,controller,ruby-on-rails-3.2,default-scope,url-helper,View,Controller,Ruby On Rails 3.2,Default Scope,Url Helper,目前,我正在使用Desive开发一个简单的Rails 3 web应用程序。当用户注册时,将创建一个帐户。这是账户模式的本质: class Account < ActiveRecord::Base include Authority::UserAbilities # Callbacks after_create do |account| account.create_person account.add_role :owner, account.pers

目前,我正在使用Desive开发一个简单的Rails 3 web应用程序。当用户注册时,将创建一个
帐户
。这是账户模式的本质:

class Account < ActiveRecord::Base
  include Authority::UserAbilities

  # Callbacks
  after_create do |account|
      account.create_person
      account.add_role :owner, account.person
  end

  has_one :person, dependent: :destroy
end

暂时取消编辑操作范围的最佳方法是什么,我应该在
PeopleController\edit
中执行此操作吗?

因此在写了这篇文章之后,我意识到在
PeopleController\edit
中使用
@person=person.unscoped.find(params[:id])
进行取消编辑效果很好。。。但也许其他人有另一种技术。
class Person < ActiveRecord::Base
  belongs_to :account
  default_scope where(published: true)
end
ActiveRecord::RecordNotFound in PeopleController#edit
Couldn't find Person with id=126 [WHERE "people"."published" = 't']