草庐IT

state-machine

全部标签

ruby-on-rails - 跳过状态机方法的所有验证

当我的预订模型通过rake任务在状态机上转换时,我试图找出如何跳过对ActiveRecord对象的特定实例的验证。我想在reservation.close时跳过所有验证!叫做。希望调用reservation.close!(:validate=>false)之类的东西。仅供引用,我们正在使用https://github.com/pluginaweek/state_machine用于状态机。这是我的预订模型的示例。classReservation["requested","negotiating","approved"])}state_machine:initial=>'requested

ruby-on-rails - Puma .state 文件

我正在尝试使用Capistrano部署带有puma的Rails应用程序。在部署结束时它尝试运行bundleexecpumactl-S/home/deployer/production/shared/sockets/puma.state重启失败了/undefinedmethod`has_key?'forfalse:FalseClass.我只是为puma.state创建了一个空文件。我的问题是这个文件到底是什么,里面应该有什么? 最佳答案 Puma有一个状态文件,记录了进程的PID。如果你是第一次部署,你应该删除.state文件,然后做

ruby-on-rails - rails:为#<StateMachine::Machine:0xba3014ec> 调用了 protected 方法 `around_validation'

我正在尝试实现state_machinegem,在我的rails项目中,我安装了gem,然后我将“state”列添加到我的account_entries模型中:defchangeadd_column:account_entries,:state,:stringend然后在我的account_entries模型中,我添加了状态机初始方法,如下所示:state_machine:state,:initial=>:submitteddoend然后在我看来我显示时间进入状态:account_entry.state但是当我尝试从我的应用程序创建一个account_entry时,我得到了这个错误:p

ruby-on-rails - 你为 Rails 推荐哪个状态机插件?

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于StackOverflow来说是偏离主题的,因为它们往往会吸引自以为是的答案和垃圾邮件。相反,describetheproblem以及迄今为止为解决该问题所做的工作。关闭9年前。Improvethisquestion我正在为Rails3/ActiveRecord项目寻找一个相对简单的状态机插件。我做了一些研究并提出了以下插件:转换:https://github.com/qoobaa/transitions从旧的ActiveRecord状态机库中提取

ruby-on-rails - 使用 state_machine 进行条件验证

我正在使用state_machine构建一个多步骤表单,在过渡到下一步之前验证每个步骤的字段。这是我的模型:classFoo:step1doevent:nextdotransition:step1=>:step2transition:step2=>:step3endevent:previousdotransition:step3=>:step2transition:step2=>:step1endstate:step1dovalidates_presence_of:field1endstate:step2dovalidates_presence_of:field2endstate:st

ruby-on-rails - state_machine 仅适用于新记录

我似乎无法获得state_machinegem(http://github.com/pluginaweek/state_machine/)来处理现有记录(它可以在新记录上正常工作)。这是我的模型:classComment:pendingdoevent:publishdotransitionall=>:publishedendendend这是一个演示该问题的IRBsession(我做了ActiveRecord::Base.logger=Logger.new(STDOUT)以使其更易于阅读):>>c=Comment.new=>#>>c.state=>"pending">>c.publish

org.elasticsearch.cluster.block.clusterblockexception: blocked by: [service_unavailable/1/state not

文章目录一.搭建集群时出现错误错误日志elasticsearch.logorg.elasticsearch.cluster.block.clusterblockexception:blockedby:[service_unavailable/1/statenotrecovered/initialized];原因:解决方案:一.搭建集群时出现错误错误日志elasticsearch.logorg.elasticsearch.cluster.block.clusterblockexception:blockedby:[service_unavailable/1/statenotrecovered/i

ruby - SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: 版本号错误 (OpenSSL::SSL::SSLError)

当我运行https.ssl_version=:TLSv1_2我得到了错误ruby/2.1.0/net/http.rb:920:in`connect':SSL_connectreturned=1errno=0state=SSLv3readserverhelloA:wrongversionnumber(OpenSSL::SSL::SSLError)当我更改为https.ssl_version=:SSLv3ruby/2.1.0/net/http.rb:920:in`connect':SSL_connectSYSCALLreturned=5errno=0state=SSLv3readserve

ruby-on-rails - SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 读取服务器 hello A - Faraday::Error::ConnectionFailed

我在这里看到了很多答案,但没有一个有效。我正在使用omniauth-oauth2gem与第三方客户集成。我正在使用描述的设置阶段here但我总是收到这个错误:Authenticationfailure!failed_to_connect:Faraday::Error::ConnectionFailed,SSL_connectSYSCALLreturned=5errno=0state=SSLv2/v3readserverhelloAFaraday::Error::ConnectionFailed(SSL_connectSYSCALLreturned=5errno=0state=SSLv2

ruby-on-rails - state_machine 中状态的命名范围

我使用state_machine在我的Rails3.1应用程序之一上使用ActiveRecord。我发现访问具有不同状态的记录的语法很麻烦。是否可以将每个状态同时定义为作用域而不用手写作用域定义?考虑以下示例:classUser:foodostate:foostate:bar#...endend#state_machinesyntax:User.with_status:fooUser.with_status:bar#desiredsyntax:User.fooUser.bar 最佳答案 我正在将以下内容添加到我的模型中:state_