问题标签 [ruby-on-rails-4.1]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby-on-rails - 无法使用 Active Admin 和 Rails 4.1 创建具有“二进制”字段的模型
我正在使用 ActiveAdmin 创建“幻灯片”,它们实际上是在数据库中存储为二进制文件的图像:
我的管理脚本也很简单:
所以当我按下“创建幻灯片”按钮时,我得到了这个异常:
我昨天又开始使用 Rails,但我一直是个新手。我对“强参数”了解一些,我认为 UploadFile 对他们来说是有效的类型。所以很奇怪为什么我有这个错误。我使用 Rails 4.1 和 Active Admin 0.6.3。
ruby-on-rails - Mysql2 0.3.15 TypeError:无法将零转换为字符串
我正在尝试创建一个新的 Rails 4.1 项目mysql2 0.3.15
并获得以下错误和堆栈跟踪。当我强制mysql2 0.3.14
时没有错误。
这是我的database.yml
文件
我的 MySQL 客户端库是 OSX 10.9.2 上的 5.6.16
更新
如果我在我的文件中指定password
,host
和,这个错误就会消失。现在出于某种原因需要这些吗?port
database.yml
ruby-on-rails - Rails 4中的Opencv Gem捆绑安装错误
我已经从https://github.com/Itseez/opencv/tree/2.4.0克隆了 opencv
然后我使用安装在我的 ubuntu 12.04 中
使用上述文档安装后,
我在我的应用程序的 Gemfile 中添加了 'gem 'ruby-opencv' ,'0.0.8'' 。
bundle install 抛出以下错误,
我正在使用 Ruby 版本 - 2.1.1
Rails 版本 - 4.1.1
任何人都可以帮助我解决这个问题吗?
ruby-on-rails - Rails 4.1.1 w/ pg_search - “PG::SyntaxError: ERROR: syntax error at or near "AS"” 错误
我从 RoR 4.0.4 更新到 4.1.1 以应用最新的安全补丁,它似乎 pg_search 坏了。
这是一个错误:
PG::SyntaxError: 错误: "AS" LINE 1 或附近的语法错误: ...sh', ''' ' || 不重音('横幅') || ' ''')), 0))) AS pg_sear...
我正在通过 ajax 进行搜索,但根据上面的输出,我认为这不是问题所在。我也在使用 will_paginate,但我使用的分支应该可以解决 rails 4.1.x 和 pg_search 之前的问题。
这是我正在执行搜索的代码模型:
在 RoR 版本碰撞之前一切正常 - 希望有人可以提供一些建议。
这是完整的堆栈跟踪:
ruby-on-rails-4.1 - (Rails4,Carrierwave gem)未初始化的常量 Ticket::Asset
我正在使用rails4。我添加了一个载波宝石。使用载波时出错。我正在以票证模型上传文件。当我去新票时,它会抛出一个错误未初始化的常量 Ticket::Asset。票务控制器
资产模型
路线
ruby-on-rails - Rails 4.1 MissingAttributeError
我有一个模型分类
在 Rails 4.0.5 上,以下代码可以正常工作。在 Rails 4.1.1 上它没有
此外,我没有paypal_transaction_response_id
属性。我想这里有一些不好的魔法,因为它试图猜测一些不存在的属性。
我在 Rails 4.1 更改日志中没有发现任何可能暗示此问题的更改。
我能做些什么?
ruby-on-rails - 使用 koala gem 获取 facebook 好友不会返回所有好友
我使用的代码直接来自自述文件。
有什么我想念的吗?
PS:应用程序尚未获得批准。
ruby-on-rails-4 - 如何在 Rails4 中为整个应用程序提供一个库
我想为整个应用程序提供许多方法。根据我阅读和研究的内容,我做了以下工作:
并在其中定义了一些方法。
但是,这不起作用,因为当我尝试调用任何控制器或视图中的方法之一时,我收到错误消息:
这适用于 Rails 4.1
ruby-on-rails - 在模型中使用 accept_nested_attributes_for 时出现 Rails 4.1 错误
这个类分配代码在 rails v4.0.5 之前是可以的,但它从 rails 4.1.x 出错
有一个api 文档,所以我猜它没有被弃用。
我不知道这是什么问题。
在 Rails 4.0.5 上没问题
javascript - Using layout specific javascript in comfy leads to InvalidCrossOriginRequest
I'm using Comfy for building custom layouts within the web application. My problem now is, that when I try to embed the code for dynamically loading the javascript as follows:
This code can be found in my application.html.erb
file.
When I now load the page with a comfy-defined layout I get this error:
One possibility to resolve this issue is to remove the attribute protect_from_forgery
in the application_controller.rb
file. But this is not a good solution.
The same problem occurs when I embed the links to the javascript within the layout in the admin panel.
I hope you can help me.