首页 \ 问答 \ Ruby on Rails form_for选择字段与类(Ruby on Rails form_for select field with class)

Ruby on Rails form_for选择字段与类(Ruby on Rails form_for select field with class)

我在这个墙上撞我的头。 我想使用f.select标签做一个简单的选择标签,但是我没有做任何工作。 我举了一个例子:

<%= f.select(:object_field, ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 4'], :class => 'my_style_class')%>

好的,基本上这是一个简单的列表,一旦提交了表单,它将值放入object_field 。 这一切都有效,但是不包括查看页面来源的类标签。 它不会抛出错误,它只是一起跳过。

如果有人有任何建议,我将非常感谢。


I am beating my head against the wall on this one. I want to make a simple select tag using the f.select tag but nothing I do works. I put an example below:

<%= f.select(:object_field, ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 4'], :class => 'my_style_class')%>

Ok, so basically it is a simple list that once the form is submitted it places the value into the object_field. That all works, but viewing the page source the class tag is not included. It doesn't throw an error, it just skips it all together.

If anyone has any suggestions I would greatly appreciate it.


原文:https://stackoverflow.com/questions/4081907
更新时间:2023-04-03 07:04

最满意答案

请注意,在最新版本的Chrome中,这些错误将显示在Javascript控制台中。

例如

The page at https://mysecuresite.com displayed insecure content from http://unsecuresite.com/some.jpg.

Note, in recent versions of Chrome, these errors will be displayed in the Javascript Console.

e.g.

The page at https://mysecuresite.com displayed insecure content from http://unsecuresite.com/some.jpg.

相关问答

更多
  • 在Firefox中,右键单击页面并转到Inspect Elements; 这会带来控制台和开发人员工具。 查看“所有选项卡”以查看被阻止元素的列表。 或者在Firefox中使用附加的Firebug ; 它有一个更广泛的工具集。 一个常见问题是用于CDN脚本的链接,例如Google。 您可以在链接中使用URL构造src="//url.to/script.js" ,它们将自动检测http和https。 看看为什么我突然在Firefox中遇到“阻止加载混合活动内容”问题? In Firefox, right cl ...
  • 看起来Mozilla的CSP(内容安全策略)在Firefox 4中实施,部分解决了这个问题。 它可以将在您的站点上加载的内容限制为仅SSL端口,并在浏览器尝试加载非SSL的情况下将报告发送回指定的URL。 目前为止只有Firefox 4,但我们有足够的FF4用户,这可以作为一个体面的预警系统。 Update 8/15:Chrome也支持CSP。 我已经在生产中有效地将它用作混合内容错误的预警系统。 它看起来大致如下: X-WebKit-CSP-Report-Only:default-src https:'u ...
  • 听起来,当应该通过HTTPS加载时,该页面上的某种资产正在通过HTTP加载。 我会检查您的所有图像,CSS和JavaScript文件,并确保它们作为HTTPS链接。 或者更好的是,查看协议相对URL以避免此问题。 It sounds like some sort of asset on that page is being loaded in through HTTP when it should be loaded in through HTTPS. I would check all of your i ...
  • 请注意,在最新版本的Chrome中,这些错误将显示在Javascript控制台中。 例如 The page at https://mysecuresite.com displayed insecure content from http://unsecuresite.com/some.jpg. Note, in recent versions of Chrome, these errors will be displayed in the Javascript Console. e.g. The page ...
  • 如果您的页面正在使用https://www.server.com/main/index.jsp(SSL )进行访问,那么如果HTML代码中有任何资源,您的浏览器将抱怨“此页面包含安全和不安全的项目”这被引用http://(非SSL)。 这包括iframe 如果您的导航页面托管在同一台服务器上,那么您可以使用这样的相对URL阻止“不安全的内容”消息