我刚刚用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) 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 后端是否配置错误?
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) 我想发送一封电子邮件,其中包含返回我的应用程序的深层链接,但我不想对 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 (3.0.0) 时,它失败并显示:
ruby-build: definition not found: 3.0.0
显然,Ruby 3 已经发布一个多月了,所以我猜团队在为 Apple Silicon (M1) 构建/打包它时遇到了问题,或者还没有人有足够的带宽来这样做。我将如何跟进此事?
我是 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)