Rails 应用程序无法识别生产中批量分配的 own_to 关联
我有一个属于客户经理的帐户模型:
class Account < ActiveRecord::Base
belongs_to :account_manager, :class_name => 'User'
validates_presence_of :account_manager
end
我的控制器如下所示:
def create
@account = Account.new(params[:account])
...
请求如下所示:
Started POST "/accounts" for 74.61.248.151 at Sun Sep 26 16:12:26 +0000 2010
Processing by AccountsController#create as HTML
Parameters: {"commit"=>"Create Account", "account"=>{"name"=>"", "account_manager_id"=>["171"]}, "authenticity_token"=>"T4ERO0iMtseI952LP/9gf5EcYrRCE/3pQFdSgqi3hNg=", "utf8"=>"\342\234\223"}
由于某种原因,在提交此请求后,表单显示客户经理为空。但这仅发生在生产中,而不发生在本地开发中。有人以前见过这个吗?唯一的区别是我在生产中使用 REE,但我认为这不会成为问题,因为这是 Rails 功能。 Rails 版本在本地和产品上相同 - 3.0.0
I have an Account model that belongs to an account manager:
class Account < ActiveRecord::Base
belongs_to :account_manager, :class_name => 'User'
validates_presence_of :account_manager
end
My controller looks like this:
def create
@account = Account.new(params[:account])
...
A request looks like this:
Started POST "/accounts" for 74.61.248.151 at Sun Sep 26 16:12:26 +0000 2010
Processing by AccountsController#create as HTML
Parameters: {"commit"=>"Create Account", "account"=>{"name"=>"", "account_manager_id"=>["171"]}, "authenticity_token"=>"T4ERO0iMtseI952LP/9gf5EcYrRCE/3pQFdSgqi3hNg=", "utf8"=>"\342\234\223"}
For some reason, after submitting with this request the form says that the account manager is blank. But this only happens on production, not on local dev. Anyone seen this before? The only difference is I use REE on production but I wouldn't think that would be an issue since this is Rails functionality. Rails version is the same on local and prod - 3.0.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不得不做这个丑陋的黑客:
也许这是一个 Rails 错误。很想看看其他人是否遇到这个问题。
I had to do this ugly hack:
Maybe this is a rails bug. Curious to see if other people experience this issue.