标签: ruby-on-rails-4

获取没有空值的哈希长度

filters = {
  "start_year" => "2009",
  "end_year" => "2011",
  "theme" => "",
  "discipline" => ""
}
Run Code Online (Sandbox Code Playgroud)

filters.length是的4,但我想得到2(那些不仅有钥匙,还有价值的人)

ruby arrays ruby-on-rails-4

-2
推荐指数
1
解决办法
184
查看次数

Rails 4资产错误,没有加载图像

长话短说,因为我浪费了足够的时间与这个愚蠢的框架.我想使用纯CSS,没有SCSS,没有css.erb,没有mumbo-jumpo,它增加了更多的开销解析,即使它超过2ms.

我的production.rb文件有(我正在使用webrick):

Properties::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both thread web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is …
Run Code Online (Sandbox Code Playgroud)

css ruby ruby-on-rails ruby-on-rails-4

-4
推荐指数
1
解决办法
3439
查看次数

我有以下错误: PG::UndefinedColumn: 错误: 列 Students.year_course_id 不存在 LINE 1

更改我的代码!我有以下错误: PG::UndefinedColumn: 错误: 列 Students.year_course_id 不存在 第 1 行: SELECT COUNT( ) FROM "students" WHERE "students"."year_cour... ^ : SELECT COUNT( ) FROM "students " 其中“学生”."year_course_id" = $1

ruby activerecord ruby-on-rails ruby-on-rails-4

-5
推荐指数
1
解决办法
1万
查看次数

从字符串 rails 4 中删除双引号

我有一个像这样的字符串:

str= "1,2,3,4"
Run Code Online (Sandbox Code Playgroud)

我想从这个字符串中删除双引号,这样我就会得到像1,2,3,4. 请帮帮我。

ruby ruby-on-rails-4

-6
推荐指数
1
解决办法
7757
查看次数