jjzjj

up-button

全部标签

ruby-on-rails - rails 上的 ruby : radio buttons for collection select

我有一个集合选择:此方法的单选按钮是什么?谢谢 最佳答案 Rails3中没有这样的助手。在Rails4中,它是collection_radio_buttons. 关于ruby-on-rails-rails上的ruby:radiobuttonsforcollectionselect,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/18525986/

ruby-on-rails - 每当 gem : I set :output but the logfile doesn't show up where I'd expect it to

在我的schedule.rb文件中,我有以下几行:set:output,'/log/cron_log.log'every5.minutesdocommand'echo"hello"'end我按照这个问题Rails,usingwhenevergemindevelopment中的建议运行了whenever-w,并且我假设cronfile已编写并正在运行。(我也尝试重新启动Rails服务器。)当我运行$crontab-l时,我看到以下内容:0,5,10,15,20,25,30,35,40,45,50,55****/bin/bash-l-c'echo"hello">>/log/cron_log

ruby-on-rails - Rails 设计 : "You need to sign in or sign up before continuing" instead of "You will receive an email with instructions.."

我已经安装了DeviseonRails4.2.0,一切似乎都在工作,我使用了以下指南:http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/我的设计模块是:devise:database_authenticatable,:registerable,:confirmable,:recoverable,:rememberable,:trackable,:validatable,:omniauthable唯一的问题是,如果我尝试通过转到注册页面创建一个新帐户,然后在输入我的电子邮

ruby-on-rails - Rails add_index 算法 : :concurrently still causes database lock up during migration

为了防止在迁移到生产站点期间出现数据库事务错误,我们遵循了https://github.com/LendingHome/zero_downtime_migrations中列出的建议。(具体由https://robots.thoughtbot.com/how-to-create-postgres-indexes-concurrently-in概述),但在特别大的表上创建索引期间,即使是索引创建的“并发”方法也会锁定表并导致该表上的任何ActiveRecord创建或更新导致各自的事务失败有PG::InFailedSqlTransaction异常。下面是我们运行Rails4.2(使用Acti

ruby-on-rails - Ruby on Rails 中的 Button_to 错误路由

我正在尝试使用button_torails助手。我写了下面的代码:'mark-button'%>得到如下错误信息Noroutematches"/items/1/edit"但是当我刷新页面时,它会执行适当的操作。我得到的页面的URL是localhost:3000/items/1/edit这是正确的网址。如果我切换button_to命令link_to页面加载没有错误。意思是这段代码:'mark-button'%>加载正常。也许有一些特点button_to我不知道,但我迷路了。 最佳答案 我认为您可能误用了button_to。我一直认为,

ruby - 如何将 Ruby 哈希 "up"中的属性移动一级

x={:name=>"John",:data=>{:physical=>{:age=>25,:weight=>150}}}我希望将数据的子属性向上移动一个级别(但不一定只是简单地展平所有属性)。在这种情况下,我基本上想将:physical属性“向上”移动一个级别。我正在尝试这个y=x[:data']y.each{|key|x[key]=y[key]}但是我得到...x=x.except(:data)=>{:name=>"John",[:physical,{:age=>25,:weight=>150}]=>nil}我在找...=>{:name=>"John",:physical=>{:a

ruby-on-rails - Rails4 : Why resque worker is not picking up jobs

我在我的Rails4应用程序中使用resque和resque_scheduler。我的应用程序正在为resque提供一些工作,但工作人员没有在处理这些工作。reque-web显示没有失败。我已经通过运行开始resqueworkerQUEUE=kqueuerakeenvironmentresque:work我的rails控制台2.0.0p353:006>Resque.info=>{:pending=>0,:processed=>0,:queues=>0,:workers=>1,:working=>0,:failed=>0,:servers=>["redis://localhost:637

ruby - DRY up Ruby 三元

我经常有这样一种情况,我想做一些条件逻辑,然后返回一部分条件。如何在不重复true或false表达式中的条件部分的情况下执行此操作?例如:ClassName.method.blank??false:ClassName.method有没有办法避免重复ClassName.method?这是一个真实世界的例子:PROFESSIONAL_ROLES.key(self.professional_role).nil??948460516:PROFESSIONAL_ROLES.key(self.professional_role) 最佳答案 假设

ruby - 首先 vagrant up 有效,但在停止/启动后出现 ruby​​ 错误

我已经安装了ruby2.1.6,vagrant1.7.2abdvirtualbox4.3.28。第一个vagrantup工作正常,盒子被下载,服务器工作,但是当我运行halt然后尝试另一个vagrantup我得到下面的ruby​​错误信息C:/Users/Mike/.vagrant.d/gems/gems/childprocess-0.5.6/lib/childprocess/windows/lib.rb:308:[BUG]Segmentationfaultruby2.0.0p353(2013-11-22)[i386-mingw32]//lotsofoutputlistingrubyf

ruby-on-rails - Rails 上的 ruby : How to have multiple submit buttons going to different methods (maybe with with_action? )

这个问题在这里已经有了答案:HowdoIcreatemultiplesubmitbuttonsforthesameforminRails?(7个答案)关闭9年前。所以..'save'%>'library'%>然后在我的Controller中:with_actiondo|a|a.savedoenda.librarydoendend问题是只有一个操作被调用...两个submit_tags调用相同的操作...知道为什么吗?或者我如何获得两个按钮以将表单提交给两种不同的方法?