草庐IT

auth_delay

全部标签

ruby-on-rails - delayed_job : 'undefined method' error when using handle_asynchronously

我正在尝试使用delayed_job将更大的csv导入到我的rails数据库中。这是我的Controller和模型方法:Controller方法defimportInventoryItem.import(params[:file],params[:store_id])redirect_tovendors_dashboard_path,notice:"InventoryImported."end模型方法defself.import(file,store_id)CSV.foreach(file.path,headers:true)do|row|inventory_item=Inventor

ruby-on-rails - 使用 rails 在启动时启动 delayed_job

当我启动Rails服务器时,我想在我的生产中启动脚本/delayed_job。无论如何我可以做到这一点吗?编辑::我已将此行添加到我的config/initializers/delayed_job.rb中。Delayed::Worker.new.start但是当我运行Rails应用程序时,我的延迟作业服务器没有启动。还有其他解决办法吗?? 最佳答案 我建议使用Capistrano部署您的应用程序并定义一个after:deployHook以在每次部署时启动/重启DJ。我还建议使用Resque而不是DelayedJob,因为后者往往会无

ruby-on-rails - Devise_token_auth 和 Devise 使用用户名和电子邮件登录

在尝试向我现有的Rails应用程序添加token身份验证时,我不断遇到错误,它源于设计authentication_keys。在我的Rails4应用程序中,我允许用户使用用户名或电子邮件登录,我想为API提供相同的功能。我从API登录时得到的错误如下StartedPOST"/api/v1/auth/sign_in"for127.0.0.1at2016-04-1923:40:26-0400ProcessingbyDeviseTokenAuth::SessionsController#createasJSONParameters:{"login"=>"email@example.com",

ruby-on-rails - 在 rails link_to 路径中设置 auth header

我必须向请求添加授权header。我尝试添加::headers=>$auth_headers在方法中:link_to("Verify",agency_verify_path(agency),:method=>:put,:headers=>$auth_headers)但token认证失败。 最佳答案 您不能在link_to中设置header。创建一个Controller操作来设置正确的header并将用户重定向到您的目的地。此外,更喜欢auth_headers或@auth_headers而不是$auth_headers。

ruby-on-rails - 使用适用于 Ruby 的 Google Auth 库登录用户

我想用google-auth-library-ruby登录用户gem。在他们的指南“服务器端应用程序的Google登录”中,他们有agoodcodeexample如何交换IDtoken的授权代码,但它仅适用于Python(和Java):credentials=client.credentials_from_clientsecrets_and_code(CLIENT_SECRET_FILE,['https://www.googleapis.com/auth/drive.appdata','profile','email'],auth_code)有人知道Ruby的等价物吗?附言。我熟悉om

ruby-on-rails - delayed_job -i 通过 cron 脚本通过 ruby​​ 停止之前的进程后将不会启动

所以我遇到了一个奇怪的情况,我有delayed_job2.0.7和守护进程1.0.10以及ruby​​1.87和rails2.3.5在ScientificLinux6.3版(Carbon)上运行。我有一个rake任务,每晚重新启动延迟的作业,然后进行一堆批处理。我以前只是做ruby​​script/delayed_job停止然后开始。我添加了一个命名队列的反向端口,允许我执行命名队列。因此,正因为如此,我想为每种类型的命名队列启动几个进程。为此,我发现最好的方法似乎是使用-i以不同方式命名每个进程,以免它们发生冲突。我编写了一些ruby​​代码来执行此循环,它在开发中运行良好,在命令行

ruby - 了解 delayed_job 状态

我已经使用delayed_job在我的Rails应用程序中实现了长时间运行的任务连同delayed_job_web.我的delayed_job配置指示作业尝试一次,并保留失败:config/initializers/delayed_job.rb:Delayed::Worker.max_attempts=1Delayed::Worker.destroy_failed_jobs=false我尝试了2个自动引发错误的测试作业,以查看失败的行为。我得到的是以下内容:我的预期是失败的作业计数为2,但排队/工作/待处理都为0。我找不到任何关于确定工作是否入队/工作/待定的文件,甚至是工作之间的区别

ruby-on-rails - Rails devise_token_auth gem,如何设置密码重置链接?

我在使用此gem的密码重置功能时遇到问题。https://github.com/lynndylanhurley/devise_token_auth这是来自文档。/password/editGET"Verifyuserbypasswordresettoken.ThisrouteisthedestinationURLforpasswordresetconfirmation.Thisroutemustcontainreset_password_tokenandredirect_urlparams.Thesevalueswillbesetautomaticallybytheconfirmati

ruby-on-rails - delayed_job 的 exception_notification

delayed_job是否有类似exception_notification的gem?最好与REE-1.8.7和Rails2.3.10一起使用。 最佳答案 我过去曾为延迟的工作佣金任务做过类似的事情:require'action_mailer'classExceptionMailer:environment)doResort.sync_all!result=Delayed::Job.work_offunlessresult[1].zero?ExceptionMailer.deliver_exception_message("[SYN

python - delayed_job 就像 python 的队列

我需要一个队列来将数据从ruby​​发送到python该系统是一个具有Ruby前端和Python后端的应用程序,我不想添加另一个复杂的部分。如果只有ruby​​,我会选择delayed_job,但ruby​​->python更难。所以我正在为python寻找一个基于简单数据库的队列(类似于delayed_job),我打算为此破解ruby​​“生产者”部分。或者给我一个我还没有想到的解决方案给我一个惊喜。 最佳答案 也许你可以看看Celery. 关于python-delayed_job就像