小编tur*_*den的帖子

为什么Rails 4.2 +响应者一直告诉我向Gemfile添加响应者?

我正在将Rails 4.1.8应用程序(也使用rails-api~> 0.3.1)升级到4.2.0.rc2,并希望保留该respond_with功能.我已添加responders到Gemfile中,但是当我bin/rake spec,我得到:

/Users/sloveless/.gem/ruby/2.1.0/gems/actionpack-4.2.0.rc2/lib/action_controller/metal/mime_responds.rb:10:in `respond_to': The controller-level `respond_to' feature has been extracted to the `responders` gem. Add it to your Gemfile to continue using this feature: (NoMethodError)
  gem 'responders', '~> 2.0'
Consult the Rails upgrade guide for details.
    from /Users/sloveless/Development/twilight/app/controllers/application_controller.rb:6:in `<class:ApplicationController>'
    from /Users/sloveless/Development/twilight/app/controllers/application_controller.rb:1:in `<top (required)>'
    from /Users/sloveless/.gem/ruby/2.1.0/gems/activesupport-4.2.0.rc2/lib/active_support/dependencies.rb:274:in `require'
    from /Users/sloveless/.gem/ruby/2.1.0/gems/activesupport-4.2.0.rc2/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/sloveless/.gem/ruby/2.1.0/gems/activesupport-4.2.0.rc2/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/sloveless/.gem/ruby/2.1.0/gems/activesupport-4.2.0.rc2/lib/active_support/dependencies.rb:274:in `require'
    from /Users/sloveless/.gem/ruby/2.1.0/gems/activesupport-4.2.0.rc2/lib/active_support/dependencies.rb:360:in `require_or_load'
    from /Users/sloveless/.gem/ruby/2.1.0/gems/activesupport-4.2.0.rc2/lib/active_support/dependencies.rb:494:in `load_missing_constant'
    from /Users/sloveless/.gem/ruby/2.1.0/gems/activesupport-4.2.0.rc2/lib/active_support/dependencies.rb:184:in `const_missing'
    from /Users/sloveless/Development/twilight/app/controllers/zone_maps_controller.rb:1:in `<top (required)>'
    from …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails ruby-on-rails-4.2

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

升级到rubygems 1.8.x后,如何让`gem`再次运行?

Soooo,我从1.7.2升级到RubyGems 1.8.1使用gem upgrade --system,然后立即gem pristine --all --no-extensions按照Eric Hodel的博客推荐.在运行gem命令时遇到错误之后,我搜索了一下,发现了一些gem uninstall带有弃用警告的宝石的建议,但后来意识到我不能,因为gem uninstall只是错误 - 任何其他命令 - 包括只是普通的ol' gem.

当我运行任何这些命令时,我仍然收到一堆"已弃用"的警告,然后是这个回溯:

/Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:277:in `block in _resort!': undefined method `name' for nil:NilClass (NoMethodError)
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:276:in `sort!'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:276:in `_resort!'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:270:in `_all'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:402:in `each'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:477:in `map'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:477:in `find_files'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1061:in `load_plugins'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:85:in `<top (required)>'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sloveless/.rvm/rubies/ruby-1.9.2-p180/bin/gem:9:in `<main>'
Run Code Online (Sandbox Code Playgroud)

当我再次尝试这个时,同样的事情发生了,但是使用相同的更新命令从RubyGems 1.6.2升级.我尝试了第三次,但是使用了下面的建议gem install rubygems-update && update_rubygems …

ruby rubygems

5
推荐指数
2
解决办法
2946
查看次数

RSpec,Rails 4,Postgres,UUID主键:id为Rake + RSpec为null,但在RSpec或控制台中没问题

我正在尝试使用UgID主键来运行Postgres和Rails 4.0.0.rc2的模型,但是我的规格无法创建和销毁,但是MyThing.create还是MyThing#destroy在rails控制台上工作正常(在开发和测试中都是如此)环境)....直到我运行规范,在这种情况下,通过控制台停止工作.因此,当我运行我的规范改变我的数据库并禁止UUID密钥继续工作时,它看起来就像发生了什么.

HALP?

我按照这篇博客文章来生成我的迁移,因此我的架构看起来像:

ActiveRecord::Schema.define(version: 20130613174601) do
  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"
  enable_extension "uuid-ossp"

  create_table "growers", id: false, force: true do |t|
    t.uuid     "id",         null: false
    t.string   "name"
    t.string   "code"
    t.datetime "created_at"
    t.datetime "updated_at"
  end
end
Run Code Online (Sandbox Code Playgroud)

这是事物的进展:

创建: $ rake db:create RAILS_ENV=test

迁移:

$ rake db:migrate RAILS_ENV=test
==  CreateGrowers: migrating ==================================================
-- enable_extension("uuid-ossp")
   -> 0.0052s
-- create_table(:growers, {:id=>:uuid})
   -> 0.0043s
==  CreateGrowers: migrated …
Run Code Online (Sandbox Code Playgroud)

rspec rails-postgresql ruby-on-rails-4

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