【发布时间】:2020-12-17 13:23:52
【问题描述】:
我正在使用带有自定义控制器的设计(用户控制器,而不是设计控制器)
我需要更改 create 操作,它工作正常。它看起来像这样:
def create
super do |user|
@patient = user.build_patient
@patient.save
end
end
但是当我尝试使用 edit 操作的相同技术时,实例变量在视图中使用时似乎是 nil(当我使用 byebug/@ 时,它似乎在控制器中设置得很好987654326@手动测试)
def edit
# binding.pry
super do |user|
if current_user.physician.stripe_details_submitted
Stripe.api_key = Rails.application.credentials[Rails.env.to_sym][:stripe][:secret_stripe_test_key]
@stripe_account_dashboard_link = Stripe::Account.create_login_link(current_user.physician.stripe_account).url
end
end
end
有什么想法吗?
【问题讨论】:
标签: ruby-on-rails devise