【发布时间】:2016-12-07 19:20:45
【问题描述】:
我正在使用Devise Invitable gem 来邀请用户,在创建用户之后,我创建了一个客户端,其user_id 等于刚刚创建的用户的id
class User < ActiveRecord::Base
after_create :create_client
def create_client
new_client = Client.new()
new_client.user_id = self.id
new_client.save
end
end
这可行,但是一旦我尝试将location_id 添加到参数中,我看到了:
Unpermitted parameter: location_id
这是location_id的新方法
def create_client
new_client = Client.new()
new_client.user_id = self.id
new_client.location_id = self.location_id
new_client.save
end
我已经阅读了很多关于此问题的回复,但似乎无法找到将这个参数列入白名单的真正解决方案。有没有人有在 Rails 4 中使用 Devise 3.5 的方法
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 parameters devise devise-invitable