我的应用程序在:
ruby-2.6.4
Rails 4.2.8
activerecord-4.2.8
我升级Rails应用程序,以ruby-2.6.4
当运行在开发rake任务,进行测试,我对收到错误BigDecimal()
和.../vendor/bundle/ruby/2.6.0/gems/ruby-oci8/...
ArgumentError: invalid value for BigDecimal(): "0.E+00"
/sha/git/sha_human_resources/shared/bundle/ruby/2.6.0/gems/ruby-oci8-2.1.8/lib/oci8/bindtype.rb:35:in `BigDecimal'
...
.../vendor/bundle/ruby/2.6.0/gems/ruby-oci8-2.1.8/lib/oci8/bindtype.rb:216: warning: constant ::Fixnum is deprecated
.../vendor/bundle/ruby/2.6.0/gems/ruby-oci8-2.1.8/lib/oci8/bindtype.rb:219: warning: constant ::Bignum is deprecated
.../vendor/bundle/ruby/2.6.0/gems/ruby-oci8-2.1.8/lib/oci8/compat.rb:73: warning: constant ::Fixnum is deprecated
Run Code Online (Sandbox Code Playgroud)
我找到了几个关于更新bigdecimal
和oci8
gems 的线程,所以尝试了几个版本,发现这些有帮助git diff Gemfile
::
-gem 'ruby-oci8', '~> 2.1.5'
+gem 'ruby-oci8', '~> 2.2.8'
Run Code Online (Sandbox Code Playgroud)
并添加了一个 bigdecimal gem:
+gem "bigdecimal", ">= 2.0.0"
Run Code Online (Sandbox Code Playgroud)
现在,当我运行 rake 任务时,出现此错误:
rake aborted!
NoMethodError: undefined method `new' for BigDecimal:Class
.../vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object/duplicable.rb:111:in `<class:BigDecimal>'
.../vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object/duplicable.rb:106:in `<top (required)>'
.../vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object.rb:3:in …
Run Code Online (Sandbox Code Playgroud) 我已经看到了几个与此非常相似的问题/答案,但仍然不确定我是否理解它们是否是我需要的.如果之前有类似内容,请接受我的道歉.
我有一个包含多个存储库的私有GitHub帐户.我从我的mac创建了这些,将它们推送到GitHub,一切都很好.
从我的Ubuntu桌面,我做了一个git克隆,并将几个存储库拉到了桌面上.现在来自Ubuntu,我对文件进行了更改,添加,提交,然后将其推送到GitHub.
问题:我的mac上如何(什么命令)用于将更改下拉到我的本地存储库,以便我得到更改?UserName是JohnCowan,repo是sacnomadgolf.git
谢谢您的帮助.
希望和容易调整。我用谷歌搜索并没有找到任何关于此的内容。我正在使用 DBvis Client 对 Postgres 数据库表运行查询。
我已经在 Oracle 和 PostgreSQL 查询中大量使用了 to_char() 函数,但我想我从未注意到这种行为。
SELECT TO_CHAR(created_at, 'Month DD, YYYY') AS DATE_CREATED...;
在结果集中,月份字段被填充到 9 个空格,然后是日和年:
February 26, 2018
January 01, 2000
July 23, 2014
September 01, 2015
December 15, 2015
May 31, 2016
Run Code Online (Sandbox Code Playgroud)
我现在从文档中知道这是month
格式的工作方式,但是有没有办法在没有额外填充的情况下获得完整的月份?我希望它看起来像这样:
February 26, 2018
January 01, 2000
July 23, 2014
September 01, 2015
December 15, 2015
May 31, 2016
Run Code Online (Sandbox Code Playgroud)
每个日期后跟一个文本字段的内容,我认为如果月和日之间只有一个空格,它们会更容易阅读。
May 31, 2016 This is my text notes for this record
该记录的日期部分不美观或不美观。
感谢您提供任何提示。
我正在戴尔桌面上安装Ubuntu 13.10.我已经安装了sqldeveloper并在我的Desktop/dir中创建了一个sqldeveoper.desktop文件来启动该程序.见下面的代码.我的问题是:在我的桌面屏幕上,我看到.desktop文件是一个sqldeveloper图标(带有绿色箭头的圆形db图标).我双击图标,程序启动.图标出现在我的Unity栏中,然后图像变为'?' 问号符号.
任何想法为什么会这样?icon.png(图像)位于桌面文件指向的位置.也许文件没有从Unity栏中正确看到路径?
sqldeveloper.desktop代码:
[Desktop Entry]
Type=Application
Version=1.0
Name=SQL Developer
GenericName=Oracle Development Environment
Comment=Proprietary environment for managing Oracle databases
Exec=sqldeveloper %F
Icon=/opt/sqldeveloper/icon.png
Terminal=false
Categories=Development;IDE;
StartupNotify=true
Run Code Online (Sandbox Code Playgroud)
感谢您的任何指导.JohnC
我正在将 Rails 应用程序升级到 4.0。我收到以下弃用警告。我已经谷歌了这个,但没有找到任何告诉如何改变这一点的东西。
DEPRECATION WARNING: The :finder_sql association option is deprecated. Please find an alternative (such as using scopes)...
Run Code Online (Sandbox Code Playgroud)
这是导致警告的范围:
has_many :elective_instructors,
:class_name => "Instructor",
:finder_sql => proc { "SELECT DISTINCT people.* FROM people
INNER JOIN class_sections ON class_sections.instructor_id = people.id
INNER JOIN courses ON courses.id = class_sections.course_id
INNER JOIN taken_classes ON class_sections.id = taken_classes.class_section_id
WHERE
courses.core = FALSE
AND
taken_classes.student_id = #{id}
AND
people.type = 'Instructor'
AND
people.ignore = FALSE" }
Run Code Online (Sandbox Code Playgroud)
任何想法将不胜感激。谢谢!
我正在学习将 Rails 应用程序部署到 Heroku 的教程。它使用的是一个免费的 Heroku 帐户,其名称类似于 quiet-mountain-51138.herokuapp.com。本教程不包括添加图像。我有一个简单的测试站点并正在运行。现在,我想向网站添加一些图像,但不知道如何执行此操作。
在非heroku、非rails 应用程序上,我使用FileZilla 将文件ftp 到服务器,所以我对此非常熟悉。heroku 有类似的东西吗?
有人会指出我如何做到这一点的教程吗?
非常感激。
已编辑我想上传一张照片以显示在我的 public/index.html 页面上。就这样。我创建并部署了一个简单的作业跟踪应用程序,它不需要图片。现在我只是在寻找将图像添加到 heroku 上的应用程序的“如何” - 用于学习目的。
谢谢
我可以帮助您格式化视图中下拉列表中的日期字段。我的日期显示带有时间戳,我希望它们显示为“mm/dd/yyyy”。
在我的模型中,我有一个从表中选择日期字段的方法:
def self.get_event_dates
event_dates = UgradRsvp.find_by_sql("select distinct event_date from admissions.ugrad_rsvps where event_date is not null order by event_date desc")
end
Run Code Online (Sandbox Code Playgroud)
我们使用 Oracle 作为数据库,因此我也尝试使用 to_char(event_date, 'MM/DD/YYYY') 作为 event_date,但下拉列表中的日期仍然显示时间戳。
我的视图是一个搜索表单。用户将选择一个日期,然后查看在该 event_date 报名参加活动的所有学生的报告:
<%= select_tag "event_date", options_from_collection_for_select(UgradRsvp.get_event_dates, "event_date", "event_date") %>
Run Code Online (Sandbox Code Playgroud)
我的表 ugrad_rsvps 中有大约八个日期。它们显示为,即:“2013-04-18 00:00:00 -0400”我想让它们显示为“04/18/2013”。我尝试过使用 strftime("%m/%d/%Y"),但我只是在下拉列表视图中的行上出现错误(上面)。
有任何想法吗?谢谢,
找不到这个问题的答案。如果我有一个文件并且我对其进行了更改。我添加并提交这些更改。在推送/部署提交之前,系统会要求我对同一文件进行更多更改(与第一次更改分开)。我可以进行添加的更改、添加并提交它们,然后推送/部署吗?或者这会给我带来问题吗?
我不明白这段代码:
a = [ "a!", "b!", "c!", "d!" ]
a.collect!.with_index {|x, i| x[0...i]}
a #=> ["", "b", "c!", "d!"]
Run Code Online (Sandbox Code Playgroud)
在collect
行,这是什么x[0...i]
呢?我看到输出,但不明白它是如何做/得到它.
bigdecimal ×1
git ×1
github ×1
heroku ×1
icons ×1
postgresql ×1
ruby ×1
select ×1
tags ×1
to-char ×1
ubuntu-13.10 ×1
ubuntu-unity ×1