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
最满意答案
请注意,在最新版本的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.
相关问答
更多-
https:firefox阻止不安全的内容......但是哪些内容?(https: firefox blocks insecure content… but which content?)[2022-01-24]
在Firefox中,右键单击页面并转到Inspect Elements; 这会带来控制台和开发人员工具。 查看“所有选项卡”以查看被阻止元素的列表。 或者在Firefox中使用附加的Firebug ; 它有一个更广泛的工具集。 一个常见问题是用于CDN脚本的链接,例如Google。 您可以在链接中使用URL构造src="//url.to/script.js" ,它们将自动检测http和https。 看看为什么我突然在Firefox中遇到“阻止加载混合活动内容”问题? In Firefox, right cl ... -
检测来自Javascript的破碎的锁图标(混合安全/不安全的内容)(Detect broken lock icon (mixed secure/insecure content) from Javascript)[2024-04-10]
看起来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阻止“不安全的内容”消息 从你的问题,听起来你的导航页面是从一个单独的主机提供的,你被迫使用这样的东西在Chrome会话中访问单个不安全页面后,您在同一域中访问的所有后续页面也将被标记为不安全。 您的问题很可能来自同一域的早期页面视图。 Once you visit a single insecure page in a Chrome session, any subsequent pages you visit on the same domain will also be marked as insecure. Your issue is most likely from an earlier page ...在联系我的主机提供商后,他们发现网页被感染了。 实际上jquery.js的一部分被感染了。 得到教训。 切勿从网络的任何地方下载jquery库(或任何其他地方),但官方网站除外。 通过官方网站链接保持最新版本。 After contacting the hosting provider of mine they managed to find that the webpage was infected. Actually a part of the jquery.js was infected. Lesso ...我不认为它应该是JS或CSS问题,除非您使用绝对URL包含它们:例如,如果您在主题的模板文件中添加以下行: 这通过http而不是https提供JavaScript。 相反,你应该使用:我遇到了这个问题。 我从该链接中删除了“http:”前缀。 旧:iframe src =“ http://example.com ”> 新:iframe src =“ //example.com ”> 现在它工作得很完美。 谢谢。 Because I get this project in the meddle without any other developer I will know, this server has a reverse-inverse-proxy. Than without any ...
HTTPS页面上的不安全内容(Insecure content on HTTPS page)[2022-08-19]
如果您包含来自不安全来源(http)的内容,则封印将会中断。 它仍然是安全的,但它不会像只包含安全内容的页面那样显得突出。 If you include content from insecure sources (http), the seal will break. it's still safe but it won't be shown as prominent as on a page with only secure content inclusion.相关文章
更多- Why Ruby
- Rails 风格指导
- Rails常用插件
- Rails中的路由功能是如何对应的?
- Rails设置环境变量
- rails3+mongrel1.2.0pre2在windows下面的生产环境配置问题
- Rails 下拉框 初始化设定值
- 如何在javascript中写rails的helper代码
- rails页面文件html.erb如何访问ActiveRecord的资源
- rails安装完成后,执行rails时出现"文件名、目录名或卷标语法不正确"
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)