小编Mic*_*ell的帖子

为什么我在运行rake cucumber时得到"警告:已初始化的常量JSON :: VERSION"?

我刚刚用rvm为rails开发设置了一个Linux Mint盒子.我继续生成了一个Rails 5应用程序,设置了mysql连接,添加了cucumber-rails gem然后尝试运行:

rake cucumber
Run Code Online (Sandbox Code Playgroud)

出于某种原因,我遇到了:

/usr/bin/ruby2.3 -S bundle exec cucumber --profile default
/usr/lib/ruby/vendor_ruby/json/version.rb:3: warning: already initialized constant JSON::VERSION
/var/lib/gems/2.3.0/gems/json-1.8.5/lib/json/version.rb:3: warning: previous definition of VERSION was here
/usr/lib/ruby/vendor_ruby/json/version.rb:4: warning: already initialized constant JSON::VERSION_ARRAY
/var/lib/gems/2.3.0/gems/json-1.8.5/lib/json/version.rb:4: warning: previous definition of VERSION_ARRAY was here
/usr/lib/ruby/vendor_ruby/json/version.rb:5: warning: already initialized constant JSON::VERSION_MAJOR
/var/lib/gems/2.3.0/gems/json-1.8.5/lib/json/version.rb:5: warning: previous definition of VERSION_MAJOR was here
/usr/lib/ruby/vendor_ruby/json/version.rb:6: warning: already initialized constant JSON::VERSION_MINOR
/var/lib/gems/2.3.0/gems/json-1.8.5/lib/json/version.rb:6: warning: previous definition of VERSION_MINOR was here
/usr/lib/ruby/vendor_ruby/json/version.rb:7: warning: already initialized constant JSON::VERSION_BUILD
/var/lib/gems/2.3.0/gems/json-1.8.5/lib/json/version.rb:7: warning: …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails cucumber ruby-on-rails-5

10
推荐指数
2
解决办法
2700
查看次数

How to fix 'no fallback UI was specified' in react i18next using hooks

I am trying to implement i18next in my react component using the useTranslation hook, but it keeps saying:

Uncaught Error: Test suspended while rendering, but no fallback UI was specified.

Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.

我怎样才能添加<Suspense>比我拥有的更高的任何东西?我究竟做错了什么?我该如何解决?当我使用该<Translation>组件时,它似乎工作正常。当然,如果我关闭 Suspense 并尝试自己处理它似乎也可以正常工作,但我认为这违背了目的。我怎样才能使它真正起作用?我的 Fetch 后端是否配置错误?

测试.js

import React, { Suspense, useState, useEffect, lazy } from "react";
import PropTypes from "prop-types";

import i18n from './i18n';
import { useTranslation } …
Run Code Online (Sandbox Code Playgroud)

reactjs react-i18next react-hooks react-suspense

4
推荐指数
2
解决办法
1万
查看次数

如何获取 ActionMailer 中的基本 url?

我想发送一封电子邮件,其中包含返回我的应用程序的深层链接,但我不想对 URL 进行硬编码,否则当我从一个环境移动到下一个环境时,我必须切换它。如何从 ActionMailer 中获取 Web 应用程序的基本 url?例如,我希望能够拥有类似的东西:

<%= base_uri %>listCreate?first=foo&second=bar
Run Code Online (Sandbox Code Playgroud)

在我的测试环境中渲染如下内容:

http://localhost:30000/myApp/listCreate?first=foo&second=bar
Run Code Online (Sandbox Code Playgroud)

以及生产中的以下内容:

http://www.myDomain.com/myApp/listCreate?first=foo&second=bar
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails actionmailer

3
推荐指数
1
解决办法
4576
查看次数

在 Apple Silicon 上:ruby-build:未找到定义:3.0.0

当我尝试安装最新的 ruby​​ (3.0.0) 时,它失败并显示:

ruby-build: definition not found: 3.0.0

显然,Ruby 3 已经发布一个多月了,所以我猜团队在为 Apple Silicon (M1) 构建/打包它时遇到了问题,或者还没有人有足够的带宽来这样做。我将如何跟进此事?

ruby asdf-vm apple-silicon

3
推荐指数
1
解决办法
1077
查看次数

Ruby 3.1.2 - TZInfo::DataSources::ZoneinfoDataSource.search_path 中包含的路径都不是有效的 zoneinfo 目录

我是 ruby​​ on Rails 的初学者

使用窗口 10

Ruby 版本 3.1.2p20

Rails 版本 7.0.3

当我跑步时rails server,我看到:

=> Booting Puma
=> Rails 7.0.3 application starting in development       
=> Run `bin/rails server --help` for more startup options
Exiting
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:159:in `rescue in create_default_data_source': tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install (TZInfo::DataSourceNotFound)
        from D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:156:in `create_default_data_source'
        from D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:55:in `block in get'
        from D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:54:in `synchronize'
...
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/zoneinfo_data_source.rb:232:in `initialize': None of the paths included in TZInfo::DataSources::ZoneinfoDataSource.search_path are valid …
Run Code Online (Sandbox Code Playgroud)

ruby rubygems ruby-on-rails

1
推荐指数
1
解决办法
1774
查看次数