草庐IT

format-conversion

全部标签

javascript - "respond_to do |format|"抛出 UnknownFormat 错误

我正在尝试使用ajax从Controller呈现js文件。这个确切的代码以前总是有效,甚至在其他方法中也有效,但我突然开始收到这个错误:ActionController::UnknownFormatinMoviesController#voteActionController::UnknownFormat电影Controller:defvote...respond_todo|format|#Theerrorpointstothisline.format.jsendend投票.js.erb:$('#votes').html("");链接:电影.html.erb:_votes.html.e

ruby - 厨师属性 "no implicit conversion of String into Integer"

我正在编写一个简单地创建数据库配置文件的厨师食谱,但我对访问属性感到困惑。我有几个PHP应用程序部署到每个实例,OpsWorks对每个实例使用相同的配方,所以我在属性文件中有一些不同的设置。属性/数据库设置.rb#APIdefault[:api][:path]='app/config/database.php';default[:api][:host]='test';default[:api][:database]='test';default[:api][:username]='test';default[:api][:password]='test';食谱/数据库设置.rbChef

ruby-on-rails - Rails 4.0.0 - 获得 "no implicit conversion of nil into String"

刚刚安装了一个全新的Rails4.0.0应用程序,我在http://0.0.0.0:3000上遇到了这个错误(https://gist.github.com/hartator/6404820):noimplicitconversionofnilintoStringactiverecord(4.0.0)lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in`initialize'activerecord(4.0.0)lib/active_record/connection_adapters/sqlite3_adapte

ruby-on-rails - Rails 4 - "No Implicit Conversion of Fixnum into String"- 错误仅发生在生产中

在生产环境中运行我的Rails4.1项目时出现以下错误:ActionView::Template::Error(noimplicitconversionofFixnumintoString):8:%meta{content:"",name:"description"}/9:%meta{content:"",name:"author"}/10:=stylesheet_link_tag'application',media:'all'11:=csrf_meta_tags12:%body13:.header.navbar.navbar-inverse14:=render'layouts/he

ruby - gem 安装/更新失败,出现 "no implicit conversion of nil into String"

使用rvm,每当我尝试安装或更新gem(或ruby​​gems)时,我都会遇到同样的错误:$gemupdate--systemUpdatingrubygems-updateFetching:rubygems-update-2.6.6.gem(100%)ERROR:Whileexecutinggem...(TypeError)noimplicitconversionofnilintoString然而,我的系统ruby​​工作正常。 最佳答案 这是2.5.x版ruby​​gem安装程序中的错误。如下修补文件installer.rb(在我

html - cucumber / ruby : possible to output the "puts" to a --format html file?

我有一些调用不同模块和类的ruby​​测试,它们在执行过程中详细说明了它们使用一些“puts”命令所做的事情。如果您在控制台中运行这些测试,那么您将在控制台中看到“puts”命令的输出,但如果您使用以下选项运行测试:ruby--formathtml--outputfile.html然后所有这些信息都丢失了。有没有办法在HTML报告中记录简单的字符串消息? 最佳答案 我尝试了以下步骤:When/^Idosomething$/doputs"Hello"endThen/^somethinghappens$/doend...使用以下命令:c

ruby-on-rails - 常量 Logger::Format not defined (NameError) with activerecord

当我在env.rb中需要'active_record'时,我遇到了错误constantLogger::Formatnotdefined(NameError)/usr/local/rvm/gems/ruby-1.9.3-p125@test/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:5:inremove_const'/usr/local/rvm/gems/ruby-1.9.3-p125@test/gems/activerecord-1.6.0/lib/active_record/support/cle

ruby - 类型错误 : no implicit conversion of nil into String error

我正在尝试设置我们的CRM系统,以便在添加特定类型的记录(列表)时在wordpress中创建帖子。我找到了这个tutorial并在Rails控制台中对其进行测试。我的类(class)是:require'rubygems'require'open-uri'require'json'require'net/http'#Pleasenotethatthevanillawp-json-apiplugindoesnotsupportuserauthenticationforcreate_post.#Checkoutmyforkforauthenticationsupport:https://gi

ruby-on-rails - 未应用 ActiveRecord cache_timestamp_format 配置

我正在尝试通过在application.rb或中设置此配置config.active_record.cache_timestamp_format=:nsec来更改迁移版本时间戳格式development.rb,就像这里所说的http://guides.rubyonrails.org/configuring.html#configuring-active-record.问题是这个配置被忽略了,不管我在那里设置的格式如何,当我生成一个新的迁移时,时间戳格式保持不变。我是不是做错了什么? 最佳答案 因为显然railsmigration忽略

ruby - respond_to only format.js 用于所有 mime 类型

我有一个响应于format.js的Controller,但是,大多数请求假设旧的format.html仍然存在并抛出404异常。如何捕获Controller上的所有MIME请求并将它们仅重定向到format.js?这是当前的ControllerActiondefsearchrespond_todo|format|unless@search.nil?format.js{render:partial=>'/search/search_form',:status=>200}elseformat.js{render:partial=>'/search/not_exist',:status=>5