- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在使用 Stripe Checkout 将电子邮件从 JS 传递到 Rails 时遇到问题。我通过堆栈跟踪在第 21 行和第 25 行不断收到错误未定义的局部变量或方法 'e'
。任何帮助将不胜感激。
这是我的代码:
Rails 代码:
def create
**line 21:** @registration = Registration.new registration_params.merge(email: stripe_params[:stripeEmail],
card_token: stripe_params[:stripeToken]) //ERROR
raise "Please, check registration errors" unless @registration.valid?
@registration.process_payment
@registration.save
redirect_to @registration, notice: 'Registration was successfully created.'
rescue
**line 25:** flash[:error] = e.message // ERROR
render :new
end
JS代码:
<script src='https://checkout.stripe.com/checkout.js'></script>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_xxxxxx',
token: function(token) {
// Use the token to create the charge with a server-side script.
// You can access the token ID with `token.id`
}
});
jQuery('#customButton').on('click', function(e) {
// Open Checkout with further options
handler.open({
name: 'The Climb',
description: 'Individual',
email: 'asdfasdf999@asdf.com',
amount: 3500
});
e.preventDefault();
});
// Close Checkout on page navigation
$(window).on('popstate', function() {
handler.close();
});
</script>
最佳答案
第 24 行应该是:
rescue => e
关于javascript - 错误: "undefined local variable or method ' e'"inside RegistrationsController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31419361/
Rails 3.2.12 + 设计 2.2.3 在注册#create 中发生 NoMethodError: 未定义的方法 users_url' for # actionpack (3.2.12) li
我试图通过谷歌和此处找到解决方案,但找不到... This是唯一的问题。它只有一个答案并被接受但对我不起作用......这是我的代码: class RegistrationsController {
我正在使用 devise 的 gem,我在 Devise::RegistrationsController#create 中收到错误 LoadError #create cannot load suc
您好,我正在使用 Devise 进行用户身份验证,突然我的新用户注册无法正常工作。 这是我收到的错误。 ActionController::InvalidAuthenticityToken Rails
我正在尝试通过模态窗口(远程:true)进行设计注册,并在后端完成所有操作,并在发生某些验证错误时通过呈现 javascript 进行。到目前为止,我在路上,我的验证消息似乎工作正常,但直到我尝试上传
我得到的错误是: Net::SMTPAuthenticationError in Devise::RegistrationsController#create 504 5.7.4 无法识别的身份验证类
我不再收到任何错误,但我知道当我创建一个新用户时,不会写入 stripeToken。 controllers/users/registrations_controller.rb class Users
我决定制作一个 RegistrationsController,这样我就可以在注册时将用户重定向到特定页面。唯一的问题是用户甚至没有被创建,因为我得到了错误: Started POST "/users
我正在尝试使用 API 创建一个 Rails 3 应用程序。我使用 Devise 作为我的身份验证系统。我想让通过 API 注册和稍后登录成为可能。而且我不太确定我应该怎么做。我创建了单独的 Cont
Rails 3.2.5,设计 2.1 使用 Devise 对用户进行身份验证,但在创建新用户时遇到问题。 用户属于我在用户模型中使用 before_save 过滤器创建的帐户。这工作正常并且有一段时间
Rails 3.2.5,设计 2.1 使用 Devise 对用户进行身份验证,但在创建新用户时遇到问题。 用户属于我在用户模型中使用 before_save 过滤器创建的帐户。这工作正常并且有一段时间
我正在尝试向我的 Devise User 模型添加一些额外信息,例如名字、姓氏、年龄、性别和城市。 当我填写注册表单并单击提交时,出现此错误: SQLite3::ConstraintException
当新用户提交新用户注册表时,他们会收到以下错误消息。我怀疑是因为 devise/registrations_controller.rb 不存在。 我是否需要创建此文件夹结构和 Controller ,
我一直试图让carrierwave与亚马逊s3一起工作。代替 storage :s3 我有 storage :fog 将其更改为 storage :s3 会立即出现错误 https://stackov
我正在尝试覆盖默认设计注册 Controller 的某些功能,以便只有某些用户可以为其他用户创建帐户。因此,在 Controller /用户文件夹下名为 registrations_controlle
我在使用 Stripe Checkout 将电子邮件从 JS 传递到 Rails 时遇到问题。我通过堆栈跟踪在第 21 行和第 25 行不断收到错误未定义的局部变量或方法 'e'。任何帮助将不胜感激。
我在关注 Ryan bates RailsCast 的 devise 和 omniauth(第 235 集-devise-and-omniauth-revised)。当我尝试使用 Twitter 登录
我正在使用 devise_token_auth 为仅 API 的 Rails 应用程序设置身份验证。我正在使用以下命令在命令行中使用 httpie 测试注册创建: http POST :3000/au
我正在使用 devise_token_auth 为仅 API 的 Rails 应用程序设置身份验证。我正在使用以下命令在命令行中使用 httpie 测试注册创建: http POST :3000/au
我正在开发一个使用 Devise 3.1.1 进行用户身份验证的 Rails 4 应用程序。当我点击/users/sign_up.user 链接时,Rails 抛出以下异常: ActionContro
我是一名优秀的程序员,十分优秀!