- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 best_in_place gem 内联编辑记录和 country_select呈现可供选择的国家/地区列表。当使用 best_in_place 编辑选择字段时,我这样做:
<%= best_in_place(@home, :country_name, :type => :select, :collection => [[1, "Spain"], [2, "Italy"]]) %>
现在我想获取 country_select 拥有的所有国家/地区的列表,并将其传递到集合参数中。country_select gem 提供了一个简单的助手来呈现选择字段:
<%= country_select("home", "country_name") %>
我想替换 best_in_place 助手中的 :collection 参数以包含 country_select 提供的国家/地区列表。我知道 best_in_place 期望 [[key, value], [key, value],...] 输入到 :collection 中,但我不确定如何执行此操作。请指教。谢谢
最佳答案
只需执行以下操作即可:
<%= best_in_place @home, :country, type: :select, collection: (ActionView::Helpers::FormOptionsHelper::COUNTRIES.zip(ActionView::Helpers::FormOptionsHelper::COUNTRIES)) %>
关于ruby-on-rails-3 - 我如何将 country_select gem 与 best_in_place 编辑集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10243683/
我无法让它工作。我已按照 here 描述的安装过程进行操作。该网站上的其他解决方案没有帮助。我在开发者工具上不断收到此错误 static_pages.self-8c8a5c3….js?body=1:7
我正在使用 best_in_place gem,因此我可以在我的索引 View 中编辑多个学生。 但问题是可用性很差。我必须单击、键入信息、输入/单击并再次单击以编辑其他信息。 这是我可以按 Tab
我正在使用 best_in_place 对数据表进行页内编辑 在 ruby-on-rails 应用程序中。就地编辑工作,但我有一个 失败的极端案例。行中的一对项目 (device_name, ge
我正在使用best_in_place gem 并根据说明,为了使用 jquery.purr 实现优雅的错误处理,我所要做的就是将其添加到我的 application.js 中: //= require
我正在尝试使用 best_in_place gem,但它似乎不起作用。我遵循了 Railscast 教程,但现在运气好。当我说它不起作用时,我的意思是没有选项可以编辑屏幕上的任何内容。以默认rails
在显示页面中,我显示周期性事件发生的日期列表,以及对所有日期计算的统计信息,例如连续日期之间的最大、最小和平均间隔。 我使用 best_in_place gem 来允许就地编辑日期。但是,每次更改日期
我正在使用 best_in_place gem在我的 Rails 应用程序中允许进行内联编辑。我在尝试呈现一些文本 html 安全时遇到了问题。 没有指定文本应该是 html_safe,这是它在页面上
我查看了整个 Google 和 StackOverflow,并查看了 best_in_place javascript 代码,但无济于事。 我正在使用 best_in_place 通过文本区域编辑 P
我目前正在尝试使用 best_in_place gem 以便在 HTML 表中进行内联编辑。我正在购物车的显示 View 中显示购物车。在购物车的显示 View 中,我可以添加 lineItems。创
我无法将 gem best_in_place 添加到我的表中。 class_datatable.rb: def data class.map do |record| [
希望有一个简单的答案;我正在使用 gem best_in_place而且效果很好。我试图弄清楚如何使用以下方法创建下拉菜单: :type => :select, :collection => [] 我
Rails 3.2.11 gem 文件: gem 'jquery-rails' gem "best_in_place" 应用程序.js //= require jquery //= require j
在 Rails 项目中,我使用 best_in_place 日期选择器,但在日期格式方面遇到一些问题。 由best_in_place生成的html: 16 Aug 正如您从data-original-
我正在尝试使用 type => date 的 best_in_place gem,但我在格式方面遇到了一些问题。我的 Rails 日期格式如下: Time::DATE_FORMATS.merge!({
我从 Bernat 的博客 Rails 迷你教程中获取了评论代码 我尝试使用他的 best_in_place gem 添加就地编辑功能。在大多数情况下,它工作正常 我的代码部署在 http://fal
编辑 #2 在我看来我应该能够使用 javascript 来 JSON 解析任何 respond_with_bip(@buildingTour)返回,因为那是我需要的更新对象(我需要访问 @build
我正在使用 best_in_place gem在几个文本区域上,有时(看似随机)文本区域“跳跃”并在我单击保存时触发模糊事件,提示“放弃您的更改”警告。 代码如下: Administrator
我尝试使用以下方法执行此操作: "30", :rows => "50", :inner_class => 'occupation-edit',
关于如何在 Best In place 中使用 display_with 选项的文档并不多,但我试图让 Best_in_Place 以精简形式(mm/dd/yyyy)显示日期。 我的数据库(sqlse
我想我遗漏了一些东西,因为似乎无法通过 CSS 区分 best_in_place 值和占位符(data-nil="enter your number")。我只想将占位符的样式设置为与实际值不同,这样它
我是一名优秀的程序员,十分优秀!