草庐IT

feature_selection

全部标签

ruby-on-rails - 如何使用 grouped_collection_select 显示多选?

我正在使用以下代码来显示类别的TreeView选择框:grouped_collection_select(:categories,:category_id,Category.top_level,:children,:name,:id,:name,:include_blank=>true)如何更改它以允许多选?此外,是否可以让它显示复选框而不是选择框? 最佳答案 尝试grouped_collection_select(:categories,:category_id,Category.top_level,:children,:name

ruby - Capybara + RSpec, spec/features 目录被 rspec 忽略。命令?

我正在按照位于here的简短指南使用带有rspec的新CapybaraDSL添加到spec/features目录的测试单独运行良好,即。rails_project$rspecspec/features/my_first_feature.rb然而,当我尝试像这样对整个spec/目录运行测试时,spec/features目录被完全忽略:rails_project$rspec.指南中没有提及如何包含此目录(或其他目录)以完成我想要的包含。我真的需要这个来持续集成我的项目。有人能告诉我怎么做吗?谢谢! 最佳答案 您需要确保所有规范都以_sp

ruby - 在 collection_select rails 中选择多个选项

我知道如何组合一个从模型中获取值的简单选择框"PleaseSelectaSector")%>我的问题是如何允许用户选择多个选项,然后将它们存储在模型中。我知道我需要使用:multiple=>true但不确定语法通常对于一个模型的多个条目,我会使用accepts_nested_attributes_for,但我认为我不需要对这个例子这样做是否正确?谢谢 最佳答案 经过一些尝试和错误后确定"PleaseSelectaSector"},{:multiple=>true})%>让我选择多个选项

ruby-on-rails - 事件管理员 :select drop-down defaults to current value in development but defaults to blank in production

我有以下ActiveAdmin表单:formdo|f|f.inputs"TimesheetDetails"dof.input:jobs_assigned_worker,:label=>"Worker",as::select,collection:Worker.allf.input:worked_time_hours,:label=>"WorkedTime(Hours)"f.input:worked_time_mins,:label=>"WorkedTime(Minutes)"f.input:driving_time_hours,:label=>"DrivingTime(Hours)"f

ruby - ruby有数组方法select吗!或不?

>a=%w(abc)=>["a","b","c"]>a.select!{|e|!e.nil?}NoMethodError:undefinedmethod`select!'for["a","b","c"]:Arrayfrom(irb):2ruby1.8.7(2010-04-19patchlevel253)[i686-darwin10.5.0],MBARI0x6770,RubyEnterpriseEdition2010.02文档说有一个叫做select的方法!在数组中。http://www.ruby-doc.org/core/classes/Array.html#M000252

ruby - Textmate cucumber 包问题 - 'Run Feature' 产生错误

当我转到“运行功能”时,从cucumber功能文件中出现的弹出框中出现以下错误。我该如何解决这个问题?/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require':没有要加载的文件--/Users/evolve/Projects/i9/Tornelo/.bundle/environment(LoadError)来自/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire来自/Users/evolve/Library/Applic

ruby-on-rails - f.collection_select 不显示选择的值

在google上有很多关于此搜索的结果,甚至有人在SO上询问过-但到目前为止讨论的解决方案对我没有帮助。问题是:我有一个form_for@company|f|并且我正在为company_status_id使用f.collection_select-但是当加载表单时,如果已设置,我希望选择实际的公司状态。通过我知道的调试器,它已被设置,但我在那里显示了一个默认值。这是代码:=puts@company.company_status_id=f.collection_select:company_status_id,ListCache.company_statuses,:id,:name,{:

ruby-on-rails - 将类添加到 collection_select

我看过HowdoIsettheHTMLoptionsforcollection_selectinRails?我确信我遗漏了一些明显的东西,但我无法让它发挥作用。我的选择目前看起来像:'Broadcaston...'%>我已经尝试包括:class=>'prevent_collapse',它什么都不做,以及{:class=>'prevent_collapse'},它给出我出错了。如果有人能指出如何做到这一点,我将不胜感激! 最佳答案 collection_select(object,method,collection,value_met

ruby - RVM + Zsh "RVM is not a function, selecting rubies with ' rvm 使用.. .' will not work"

首先我要说我不是命令行专家,所以我真的几乎不知道自己在做什么。我无法让RVM和oh-my-zsh一起玩得很好。我尝试了几种不同的解决方案,其中一些是在SO上发布的,但我发现似乎没有任何解决方案可以解决问题。最初,其他人在我的机器上安装了RVM。后来我自己设置了oh-my-zsh,记得当时遇到了很多麻烦。除了这两行,我的.zhsrc文件是完全默认的exportPATH=$HOME/bin:/usr/local/bin:/usr/local/rvm/bin:$PATH#prettysurethislinedoesnothing,althoughI'veseenthisfixaround#s

ruby-on-rails - 主要 :Object 的 RSpec 3.1 未定义方法 `feature'

我正在经历相当痛苦的RSpec3.1升级。我有几个在RSpec2.99中工作的功能规范,它们提高了:undefinedmethod`feature'formain:Object我注意到我必须在我的其他规范中使用RSpec.describe,因为它们不再附加到主要对象。等效的功能调用是什么?在我的功能中我需要'rails_helper'require'rails_helper'feature'FacebookAuthentiation'do...endspec/rails_helper.rb#Thisfileiscopiedtospec/whenyourun'railsgenerater