2012-06-05 39 views
0

我試圖產生這樣一個遷移:爲什麼我的遷移中出現「未定義方法write_inheritable_attribute」錯誤?

rails generate migration RemovefromGenotypes box:integer well:string 

但後來我得到這個錯誤:

/usr/share/rails-ruby1.8/railties/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError) 
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:90:in `<class:Base>' 
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:85:in `<module:Generator>' 
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:48:in `<module:Rails>' 
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:6:in `<top (required)>' 
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator.rb:34:in `<top (required)>' 
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from /usr/share/rails-ruby1.8/railties/bin/rails:14:in `<main>' 

我不知道從哪裏開始調試這一點,但如果有人能肯定會欣賞它指向我在正確的方向...

謝謝! --rick

+0

忘了提及:我使用Rails 2.3.5和Ruby版本:ruby 1.9.3p194(2012-04-20修訂版35410)[i686-linux] – rixter

+0

嘗試下劃線版本,所有我可以說remove_column_from_genotypes框:整數好:字符串 – Viren

回答

2

我有同樣的問題。使用下面的命令和問題不見了

gem install rails 

這將安裝更新的導軌和所有工作再次查找。

+0

謝謝...但是,這沒有奏效。我運行了這個命令,但是當我啓動rails時仍然遇到同樣的錯誤: – rixter

+0

那麼,最後的工作是刪除並重新安裝ruby。感謝其他有用的消息,我使用它來刪除所有寶石:gem list --no-version | sudo xargs gem卸載$ 1 -a -x,然後使用rvm重新安裝:rvm install 1.9.3 – rixter

3

發生在我身上,而軌道3.2.6

之後再安裝導軌2.3.14看來導軌2.3將覆蓋一些軌道3個文件。修正了通過刪除2.3和重新安裝3.2

相關問題