Ruby 在 Rails - 生成设计
Ruby on Rails - generate devise
我是 Rails 上 Ruby 的新手。刚刚安装并升级了 rubygems。当我输入 ruby new project
时,我最后得到以下内容:
Use `bundle show [gemname]` to see where a bundled gem is installed.
run bundle exec spring binstub --all
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
* bin/rake: spring inserted
* bin/rails: spring inserted
我检查了 ruby 版本,它是:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
Rails版本:
Rails 4.2.0
我尝试通过将以下命令 gem 'devise'
添加到 Gemfile
来安装 devise
,然后 运行 gem install devise
得到以下内容:
Fetching: thor-0.19.1.gem (100%)
Successfully installed thor-0.19.1
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.1.gem (100%)
Successfully installed activesupport-4.2.1
Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%)
Successfully installed rails-deprecated_sanitizer-1.0.3
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.6.6.2
Fetching: rails-dom-testing-1.0.6.gem (100%)
Successfully installed rails-dom-testing-1.0.6
Fetching: loofah-2.0.1.gem (100%)
Successfully installed loofah-2.0.1
Fetching: rails-html-sanitizer-1.0.2.gem (100%)
Successfully installed rails-html-sanitizer-1.0.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: builder-3.2.2.gem (100%)
Successfully installed builder-3.2.2
Fetching: actionview-4.2.1.gem (100%)
Successfully installed actionview-4.2.1
Fetching: rack-1.6.0.gem (100%)
Successfully installed rack-1.6.0
Fetching: rack-test-0.6.3.gem (100%)
Successfully installed rack-test-0.6.3
Fetching: actionpack-4.2.1.gem (100%)
Successfully installed actionpack-4.2.1
Fetching: railties-4.2.1.gem (100%)
Successfully installed railties-4.2.1
Fetching: responders-2.1.0.gem (100%)
Successfully installed responders-2.1.0
Fetching: bcrypt-3.1.10.gem (100%)
Building native extensions. This could take a while...
Successfully installed bcrypt-3.1.10
Fetching: orm_adapter-0.5.0.gem (100%)
Successfully installed orm_adapter-0.5.0
Fetching: warden-1.2.3.gem (100%)
Successfully installed warden-1.2.3
Fetching: devise-3.4.1.gem (100%)
Successfully installed devise-3.4.1
Parsing documentation for thor-0.19.1
Installing ri documentation for thor-0.19.1
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for activesupport-4.2.1
Installing ri documentation for activesupport-4.2.1
Parsing documentation for rails-deprecated_sanitizer-1.0.3
Installing ri documentation for rails-deprecated_sanitizer-1.0.3
Parsing documentation for mini_portile-0.6.2
Installing ri documentation for mini_portile-0.6.2
Parsing documentation for nokogiri-1.6.6.2
Installing ri documentation for nokogiri-1.6.6.2
Parsing documentation for rails-dom-testing-1.0.6
Installing ri documentation for rails-dom-testing-1.0.6
Parsing documentation for loofah-2.0.1
Installing ri documentation for loofah-2.0.1
Parsing documentation for rails-html-sanitizer-1.0.2
Installing ri documentation for rails-html-sanitizer-1.0.2
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for builder-3.2.2
Installing ri documentation for builder-3.2.2
Parsing documentation for actionview-4.2.1
Installing ri documentation for actionview-4.2.1
Parsing documentation for rack-1.6.0
Installing ri documentation for rack-1.6.0
Parsing documentation for rack-test-0.6.3
Installing ri documentation for rack-test-0.6.3
Parsing documentation for actionpack-4.2.1
Installing ri documentation for actionpack-4.2.1
Parsing documentation for railties-4.2.1
Installing ri documentation for railties-4.2.1
Parsing documentation for responders-2.1.0
Installing ri documentation for responders-2.1.0
Parsing documentation for bcrypt-3.1.10
Installing ri documentation for bcrypt-3.1.10
Parsing documentation for orm_adapter-0.5.0
Installing ri documentation for orm_adapter-0.5.0
Parsing documentation for warden-1.2.3
Installing ri documentation for warden-1.2.3
Parsing documentation for devise-3.4.1
Installing ri documentation for devise-3.4.1
Done installing documentation for thor, thread_safe, tzinfo, i18n, activesupport, rails-deprecated_sanitizer, mini_portile, nokogiri, rails-dom-testing, loofah, rails-html-sanitizer, erubis, builder, actionview, rack, rack-test, actionpack, railties, responders, bcrypt, orm_adapter, warden, devise after 21 seconds
23 gems installed
然后我尝试 运行 以下命令:rails g devise user
但我仍然不断收到以下命令:Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run
gem pristine --allfor better startup performance.
什么也没发生。
我该如何继续?!
关于rubygems的警告,可以运行:
gem update --system
然后确保按顺序执行以下操作:
- 将设计添加到您的 Gemfile
- 运行
bundle
在命令行中
- 运行
rails g devise:install
在命令行中
- 运行
rails generate devise User
在命令行中。
希望对您有所帮助!
Rubygems 更新:
gem install rubygems-update
update_rubygems
应该有助于消除 rubygems 2.0.14 警告。
我是 Rails 上 Ruby 的新手。刚刚安装并升级了 rubygems。当我输入 ruby new project
时,我最后得到以下内容:
Use `bundle show [gemname]` to see where a bundled gem is installed.
run bundle exec spring binstub --all
Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
* bin/rake: spring inserted
* bin/rails: spring inserted
我检查了 ruby 版本,它是:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
Rails版本:
Rails 4.2.0
我尝试通过将以下命令 gem 'devise'
添加到 Gemfile
来安装 devise
,然后 运行 gem install devise
得到以下内容:
Fetching: thor-0.19.1.gem (100%)
Successfully installed thor-0.19.1
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.1.gem (100%)
Successfully installed activesupport-4.2.1
Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%)
Successfully installed rails-deprecated_sanitizer-1.0.3
Fetching: mini_portile-0.6.2.gem (100%)
Successfully installed mini_portile-0.6.2
Fetching: nokogiri-1.6.6.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.6.6.2
Fetching: rails-dom-testing-1.0.6.gem (100%)
Successfully installed rails-dom-testing-1.0.6
Fetching: loofah-2.0.1.gem (100%)
Successfully installed loofah-2.0.1
Fetching: rails-html-sanitizer-1.0.2.gem (100%)
Successfully installed rails-html-sanitizer-1.0.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: builder-3.2.2.gem (100%)
Successfully installed builder-3.2.2
Fetching: actionview-4.2.1.gem (100%)
Successfully installed actionview-4.2.1
Fetching: rack-1.6.0.gem (100%)
Successfully installed rack-1.6.0
Fetching: rack-test-0.6.3.gem (100%)
Successfully installed rack-test-0.6.3
Fetching: actionpack-4.2.1.gem (100%)
Successfully installed actionpack-4.2.1
Fetching: railties-4.2.1.gem (100%)
Successfully installed railties-4.2.1
Fetching: responders-2.1.0.gem (100%)
Successfully installed responders-2.1.0
Fetching: bcrypt-3.1.10.gem (100%)
Building native extensions. This could take a while...
Successfully installed bcrypt-3.1.10
Fetching: orm_adapter-0.5.0.gem (100%)
Successfully installed orm_adapter-0.5.0
Fetching: warden-1.2.3.gem (100%)
Successfully installed warden-1.2.3
Fetching: devise-3.4.1.gem (100%)
Successfully installed devise-3.4.1
Parsing documentation for thor-0.19.1
Installing ri documentation for thor-0.19.1
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for activesupport-4.2.1
Installing ri documentation for activesupport-4.2.1
Parsing documentation for rails-deprecated_sanitizer-1.0.3
Installing ri documentation for rails-deprecated_sanitizer-1.0.3
Parsing documentation for mini_portile-0.6.2
Installing ri documentation for mini_portile-0.6.2
Parsing documentation for nokogiri-1.6.6.2
Installing ri documentation for nokogiri-1.6.6.2
Parsing documentation for rails-dom-testing-1.0.6
Installing ri documentation for rails-dom-testing-1.0.6
Parsing documentation for loofah-2.0.1
Installing ri documentation for loofah-2.0.1
Parsing documentation for rails-html-sanitizer-1.0.2
Installing ri documentation for rails-html-sanitizer-1.0.2
Parsing documentation for erubis-2.7.0
Installing ri documentation for erubis-2.7.0
Parsing documentation for builder-3.2.2
Installing ri documentation for builder-3.2.2
Parsing documentation for actionview-4.2.1
Installing ri documentation for actionview-4.2.1
Parsing documentation for rack-1.6.0
Installing ri documentation for rack-1.6.0
Parsing documentation for rack-test-0.6.3
Installing ri documentation for rack-test-0.6.3
Parsing documentation for actionpack-4.2.1
Installing ri documentation for actionpack-4.2.1
Parsing documentation for railties-4.2.1
Installing ri documentation for railties-4.2.1
Parsing documentation for responders-2.1.0
Installing ri documentation for responders-2.1.0
Parsing documentation for bcrypt-3.1.10
Installing ri documentation for bcrypt-3.1.10
Parsing documentation for orm_adapter-0.5.0
Installing ri documentation for orm_adapter-0.5.0
Parsing documentation for warden-1.2.3
Installing ri documentation for warden-1.2.3
Parsing documentation for devise-3.4.1
Installing ri documentation for devise-3.4.1
Done installing documentation for thor, thread_safe, tzinfo, i18n, activesupport, rails-deprecated_sanitizer, mini_portile, nokogiri, rails-dom-testing, loofah, rails-html-sanitizer, erubis, builder, actionview, rack, rack-test, actionpack, railties, responders, bcrypt, orm_adapter, warden, devise after 21 seconds
23 gems installed
然后我尝试 运行 以下命令:rails g devise user
但我仍然不断收到以下命令:Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run
gem pristine --allfor better startup performance.
什么也没发生。
我该如何继续?!
关于rubygems的警告,可以运行:
gem update --system
然后确保按顺序执行以下操作:
- 将设计添加到您的 Gemfile
- 运行
bundle
在命令行中 - 运行
rails g devise:install
在命令行中 - 运行
rails generate devise User
在命令行中。
希望对您有所帮助!
Rubygems 更新:
gem install rubygems-update
update_rubygems
应该有助于消除 rubygems 2.0.14 警告。