Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Generate不生成代码_Ruby On Rails_Ruby_Linux_Generator - Fatal编程技术网

Ruby on rails Generate不生成代码

Ruby on rails Generate不生成代码,ruby-on-rails,ruby,linux,generator,Ruby On Rails,Ruby,Linux,Generator,我试图给出一个generate any,它不会,这个错误出现了,有时什么也没有出现,它一直运行,什么也没有出现。发生了什么事?我是这个地区的新手 root@ubuntu:~/Projeto/Projeto_testes/teste_projeto_generator# rails g scaffold User name email /usr/lib/ruby/vendor_ruby/active_support/core_ext/numeric/conversions.rb:121: warn

我试图给出一个generate any,它不会,这个错误出现了,有时什么也没有出现,它一直运行,什么也没有出现。发生了什么事?我是这个地区的新手

root@ubuntu:~/Projeto/Projeto_testes/teste_projeto_generator# rails g scaffold User name email
/usr/lib/ruby/vendor_ruby/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
root@ubuntu:~/Projeto/Projeto_testes/teste_projeto_generator#

我并没有永久地解决它,但我找到了一个解决方案来避免这个错误。 当我给出一个新的rails时,它会生成gem文件,会指定rails版本,我只需更改生成的gem文件,即我“创建”的gem文件:

源代码'https://rubygems.org'
gem'openssl','2.0.4'
#捆绑边缘Rails:gem'Rails',github'Rails/Rails'
gem'rails',github'rails/rails',branch'4-2-stable'
#使用sqlite3作为活动记录的数据库
gem'sqlite3'
#将SCS用于样式表
gem'sass-rails',“~>5.0”
#使用Uglifier作为JavaScript资产的压缩器
gem'uglifier','>=1.3.0'
#将CoffeeScript用于.coffee资产和视图
gem“咖啡轨”,“~>4.1.0”
#看https://github.com/rails/execjs#readme 获取更多受支持的运行时
#宝石“therubyracer”,平台::ruby
gem'rails-i18n',“~>4.0.0”
#使用jquery作为JavaScript库
gem'jqueryrails'
#Turbolinks使web应用程序中的以下链接更快。阅读更多:https://github.com/rails/turbolinks
gem“涡轮链接”
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder',“~>2.0”
#bundle exec rake doc:rails在doc/API下生成API。
gem'sdoc','~>0.4.0',组::doc
#使用ActiveModel具有\u安全\u密码
#gem'bcrypt',“~>3.1.7”
#使用Unicorn作为应用程序服务器
#宝石“独角兽”
#使用Capistrano进行部署
#gem“capistrano rails”,集团::开发
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
宝石“比伯”
结束
小组:发展怎么办
#在异常页面上或通过在视图中使用访问IRB控制台
gem“web控制台”,“~>2.0”
#Spring通过让应用程序在后台运行来加速开发。阅读更多:https://github.com/rails/spring
宝石“春天”
结束

我不能使用rbenv或rvm来升级我的rails,所以我做了这个“调整”。

rails g scaffold用户名电子邮件
对我很有用。不过,该警告意味着您正在使用较旧版本的Rails运行最新版本的Ruby。升级Rails(或者降级Ruby)可以解决这个问题。我该怎么做?我已经尝试了原始文档,但我不知道如何做。。。我不知道该怎么做。我相信让Rbenv(我用这个)或rvm(我在MacOSX上遇到了几个rvm问题)来管理你的ruby东西是值得的。它们允许下载和安装ruby版本,为某些项目设置“全局”ruby版本和gem集,和/或本地ruby版本,并根据需要设置所需的Gems集。我发现它的安装和使用非常困难。我尝试使用rvm,但出现了一些非常奇怪的问题,所以我下载了rbenv,但仍然存在问题,问题不在GEM文件中?我不知道,就像我说的,我是这个地区的新手。如何定义rails必须使用的版本?
source 'https://rubygems.org'

gem 'openssl', '2.0.4'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', github: 'rails/rails', branch: '4-2-stable'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'rails-i18n', '~> 4.0.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end