Ruby on rails 我得到一个;未决错误“;每当我在Rails 4.2.1应用程序中单击Pay using Payloa Payment Gem(为Stripe制作的Gem)时
使用Payloa Payments Gem处理条带支付,有必要为您的交易设置后台工作程序。使用ActiveJob设置后台工作人员后,单击“支付”时将出现错误 给您: 注意:我正在使用Windows环境(Windows 8),我相信这里有问题。 在我的视图上呈现错误警报: 这似乎花了太长时间。请联系支持部门并向他们提供交易ID:ook4dp 这里是从控制台生成的代码Ruby on rails 我得到一个;未决错误“;每当我在Rails 4.2.1应用程序中单击Pay using Payloa Payment Gem(为Stripe制作的Gem)时,ruby-on-rails,ruby-on-rails-3,ruby-on-rails-4,rails-activejob,Ruby On Rails,Ruby On Rails 3,Ruby On Rails 4,Rails Activejob,使用Payloa Payments Gem处理条带支付,有必要为您的交易设置后台工作程序。使用ActiveJob设置后台工作人员后,单击“支付”时将出现错误 给您: 注意:我正在使用Windows环境(Windows 8),我相信这里有问题。 在我的视图上呈现错误警报: 这似乎花了太长时间。请联系支持部门并向他们提供交易ID:ook4dp 这里是从控制台生成的代码 Started POST "/payola/buy/job/excelwithcode-7d492bf330ab66b0eaa61c
Started POST "/payola/buy/job/excelwithcode-7d492bf330ab66b0eaa61ce2ce277e14" for 127.0.0.1 at 2016-04-25 20:50:26 +0100
Processing by Payola::TransactionsController#create as */*
Parameters: {"stripeToken"=>"tok_184FksCc1zXXaitaOrD5ELaH", "stripeEmail"=>"neededforpayments@mybusinesstest.com", "authenticity_token"=>"Uod7Ue4XHNcCvayA6G1shiiI43QKoBOrbImnwt0TGFHVlp11WdHaNTcPl/0UyYefcT6foowc30bFdtK0cJuXog==", "product_class"=>"job", "permalink"=>"excelwithcode-7d492bf330ab66b0eaa61ce2ce277e14"}
Payola::Affiliate Load (1.0ms) SELECT "payola_affiliates".* FROM "payola_affiliates" WHERE (lower(code) = lower(NULL)) ORDER BY "payola_affiliates"."id" ASC LIMIT 1
Job Load (1.0ms) SELECT "jobs".* FROM "jobs" WHERE "jobs"."permalink" = ? LIMIT 1 [["permalink", "excelwithcode-7d492bf330ab66b0eaa61ce2ce277e14"]]
Payola::Coupon Load (1.0ms) SELECT "payola_coupons".* FROM "payola_coupons" WHERE (lower(code) = lower(NULL)) ORDER BY "payola_coupons"."id" ASC LIMIT 1
(1.0ms) begin transaction
Payola::Sale Exists (0.0ms) SELECT 1 AS one FROM "payola_sales" WHERE "payola_sales"."guid" IS NULL LIMIT 1
CACHE (0.0ms) SELECT 1 AS one FROM "payola_sales" WHERE "payola_sales"."guid" IS NULL LIMIT 1
Payola::Sale Exists (1.0ms) SELECT 1 AS one FROM "payola_sales" WHERE "payola_sales"."guid" = 'ook4dp' LIMIT 1
SQL (1.0ms) INSERT INTO "payola_sales" ("product_id", "product_type", "email", "stripe_token", "currency", "amount", "state", "guid", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["product_id", 1], ["product_type", "Job"], ["email", "neededforpayments@mybusinesstest.com"], ["stripe_token", "tok_184FksCc1zXXaitaOrD5ELaH"], ["currency", "usd"], ["amount", 20000], ["state", "pending"], ["guid", "ook4dp"], ["created_at", "2016-04-25 19:50:26.639939"], ["updated_at", "2016-04-25 19:50:26.639939"]]
SQL (0.0ms) INSERT INTO "versions" ("event", "created_at", "item_id", "item_type") VALUES (?, ?, ?, ?) [["event", "create"], ["created_at", "2016-04-25 19:50:26.639939"], ["item_id", 2], ["item_type", "Payola::Sale"]]
(150.3ms) commit transaction
[ActiveJob] Enqueued Payola::Worker::ActiveJob (Job ID: 72e9235d-e2f2-42d6-8ae4-0a74dd8bce5d) to DelayedJob(default) with arguments: "Payola::ProcessSale", "ook4dp"
[ActiveJob] (0.0ms) begin transaction
[ActiveJob] SQL (1.0ms) INSERT INTO "delayed_jobs" ("queue", "handler", "run_at", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?) [["queue", "default"], ["handler", "--- !ruby/object:ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper\njob_data:\n job_class: Payola::Worker::ActiveJob\n job_id: 72e9235d-e2f2-42d6-8ae4-0a74dd8bce5d\n queue_name: default\n arguments:\n - Payola::ProcessSale\n - ook4dp\n"], ["run_at", "2016-04-25 19:50:26.812282"], ["created_at", "2016-04-25 19:50:26.812282"], ["updated_at", "2016-04-25 19:50:26.812282"]]
[ActiveJob] (87.0ms) commit transaction
Completed 200 OK in 284ms (Views: 1.0ms | ActiveRecord: 244.3ms)
Started GET "/payola/status/ook4dp" for 127.0.0.1 at 2016-04-25 20:50:26 +0100
Processing by Payola::TransactionsController#status as */*
Parameters: {"guid"=>"ook4dp"}
Payola::Affiliate Load (1.0ms) SELECT "payola_affiliates".* FROM "payola_affiliates" WHERE (lower(code) = lower(NULL)) ORDER BY "payola_affiliates"."id" ASC LIMIT 1
Payola::Sale Load (1.0ms) SELECT "payola_sales".* FROM "payola_sales" WHERE "payola_sales"."guid" = ? LIMIT 1 [["guid", "ook4dp"]]
Completed 200 OK in 8ms (Views: 1.0ms | ActiveRecord: 2.0ms)
Started GET "/payola/status/ook4dp" for 127.0.0.1 at 2016-04-25 20:50:28 +0100
Processing by Payola::TransactionsController#status as */*
Parameters: {"guid"=>"ook4dp"}
Payola::Affiliate Load (1.0ms) SELECT "payola_affiliates".* FROM "payola_affiliates" WHERE (lower(code) = lower(NULL)) ORDER BY "payola_affiliates"."id" ASC LIMIT 1
Payola::Sale Load (1.0ms) SELECT "payola_sales".* FROM "payola_sales" WHERE "payola_sales"."guid" = ? LIMIT 1 [["guid", "ook4dp"]]
Completed 200 OK in 8ms (Views: 0.0ms | ActiveRecord: 2.0ms)
在我的浏览器的“网络”选项卡下,我得到以下信息
{guid: "ook4dp", status: "pending", error: null}
error: null
guid: "ook4dp"
status: "pending"
config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'active_job'
require 'active_record'
require 'action_controller'
require 'action_view'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module App
class Application < Rails::Application
config.i18n.enforce_available_locales = true
config.action_controller.action_on_unpermitted_parameters = :raise
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.active_record.raise_in_transactional_callbacks = true
config.active_job.queue_adapter = :delayed_job
end
end
class Job < ActiveRecord::Base
include Payola::Sellable
validates :title,
:category,
:location,
:description,
:company_name,
:website,
:email,
:to_apply,
presence: true
validates :title, length: { maximum: 75 }
validates :description, length: { minimum: 300 }
validates :to_apply, length: { maximum: 500 }
validates_formatting_of :email, using: :email
validates_formatting_of :website, using: :url
before_validation :provide_name, :provide_permalink
def self.paid_ad
where.not('stripeEmail' => nil).where.not('payola_sale_guid' => nil).where('created_at > ?', 30.days.ago)
end
def paid?
(!(self.stripeEmail == nil) && !(self.payola_sale_guid == nil))
end
def self.search(params)
jobs = Job.where('name like ? or description like?', "%#{params[:search]}%', '%#{params[:search]}%" ) if params [:search]
jobs
end
private
def provide_name
self.name = 'excelwithcode' if self.name == nil
end
def provide_permalink
self.permalink = "#{ self.name } #{ SecureRandom.hex }".parameterize if self.permalink == nil
end
end
需要文件。展开路径('../boot',文件)
需要“rails/all”
需要“主动工作”
需要“活动记录”
需要“操作\控制器”
需要“操作视图”
#需要Gemfile中列出的宝石,包括任何宝石
#您仅限于:测试、开发或:生产。
Bundler.require(*Rails.groups)
模块应用程序
类应用程序
model/job.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'active_job'
require 'active_record'
require 'action_controller'
require 'action_view'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module App
class Application < Rails::Application
config.i18n.enforce_available_locales = true
config.action_controller.action_on_unpermitted_parameters = :raise
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.active_record.raise_in_transactional_callbacks = true
config.active_job.queue_adapter = :delayed_job
end
end
class Job < ActiveRecord::Base
include Payola::Sellable
validates :title,
:category,
:location,
:description,
:company_name,
:website,
:email,
:to_apply,
presence: true
validates :title, length: { maximum: 75 }
validates :description, length: { minimum: 300 }
validates :to_apply, length: { maximum: 500 }
validates_formatting_of :email, using: :email
validates_formatting_of :website, using: :url
before_validation :provide_name, :provide_permalink
def self.paid_ad
where.not('stripeEmail' => nil).where.not('payola_sale_guid' => nil).where('created_at > ?', 30.days.ago)
end
def paid?
(!(self.stripeEmail == nil) && !(self.payola_sale_guid == nil))
end
def self.search(params)
jobs = Job.where('name like ? or description like?', "%#{params[:search]}%', '%#{params[:search]}%" ) if params [:search]
jobs
end
private
def provide_name
self.name = 'excelwithcode' if self.name == nil
end
def provide_permalink
self.permalink = "#{ self.name } #{ SecureRandom.hex }".parameterize if self.permalink == nil
end
end
类作业nil).where.not('payloa\u sale\u guid'=>nil).where('created\u at>?',30.天前)
结束
def付费?
(!(self.stripeEmail==nil)和&!(self.payloa\u sale\u guid==nil))
结束
定义自搜索(参数)
jobs=Job.where('name like?或description like?'、“%#{params[:search]}%”、“%#{params[:search]}%”)如果params[:search]
工作
结束
私有的
def提供_名称
如果self.name==nil,则self.name='excelwithcode'
结束
def提供_permalink
self.permalink=“#{self.name}{SecureRandom.hex}”。如果self.permalink==nil,则参数化
结束
结束
查看我的开发日志,我知道由于后台工作人员使用我设置的ActiveJob,交易会不断重复,但主要问题是交易从未成功,,我的错误警报会在我的条带自定义支付表单上响应,如上所述。换句话说,一旦你点击支付,它就会冻结
我仍然不知道为什么会这样,我需要你的帮助。感谢您提前帮助我解决了这个问题
问题来自/config/application.rb中的后台工作程序
注释/config/application.rb中的后台工作程序,并要求其他依赖项,以便它成为以下代码:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module App
class Application < Rails::Application
config.i18n.enforce_available_locales = true
config.action_controller.action_on_unpermitted_parameters = :raise
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.active_record.raise_in_transactional_callbacks = true
#config.active_job.queue_adapter = :delayed_job
end
end
需要文件。展开路径('../boot',文件)
需要“rails/all”
#选择您想要的框架:
需要“激活的\u模型/轨道连接”
需要“活动作业/轨道连接”
需要“活动记录/轨道连接”
需要“控制器/轨道连接的操作”
要求采取“行动”\u邮递员/railtie
需要“操作视图/轨道连接”
需要“链轮/系杆”
#需要Gemfile中列出的宝石,包括任何宝石
#您仅限于:测试、开发或:生产。
Bundler.require(*Rails.groups)
模块应用程序
类应用程序
那会解决的。我解决了这个问题
问题来自/config/application.rb中的后台工作程序
注释/config/application.rb中的后台工作程序,并要求其他依赖项,以便它成为以下代码:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module App
class Application < Rails::Application
config.i18n.enforce_available_locales = true
config.action_controller.action_on_unpermitted_parameters = :raise
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.active_record.raise_in_transactional_callbacks = true
#config.active_job.queue_adapter = :delayed_job
end
end
需要文件。展开路径('../boot',文件)
需要“rails/all”
#选择您想要的框架:
需要“激活的\u模型/轨道连接”
需要“活动作业/轨道连接”
要求者