我一直在rails3中编码,并解决了所有依赖项。现在,我已经回到了rails 2,并且存在很多依赖性问题。是否有任何理智的方法来确保根据当前的rails版本自动解决所有gems和依赖项?
我一直收到此错误
`default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
错误记录
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/gems/rails-2.3.8/lib/rails_generator/base.rb:90:in `<class:Base>'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/gems/rails-2.3.8/lib/rails_generator/base.rb:85:in `<module:Generator>'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/gems/rails-2.3.8/lib/rails_generator/base.rb:48:in `<module:Rails>'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/gems/rails-2.3.8/lib/rails_generator/base.rb:6:in `<top (required)>'
from /home/saiesh/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/saiesh/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/gems/rails-2.3.8/lib/rails_generator.rb:37:in `<top (required)>'
from /home/saiesh/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/saiesh/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/gems/rails-2.3.8/bin/rails:15:in `<top (required)>'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/bin/rails:19:in `load'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/bin/rails:19:in `<main>'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/bin/ruby_noexec_wrapper:14:in `eval'
from /home/saiesh/.rvm/gems/ruby-1.9.3-p429/bin/ruby_noexec_wrapper:14:in `<main>'
宝石清单
*** LOCAL GEMS ***
actionmailer(3.2.13,2.3.12,2.3.8) actionpack(3.2.13,2.3.12,2.3.8)
activemodel(3.2.13)
activerecord(3.2.13,2.3.12,2.3.8)
activeresource(3.2.13,2.3.12,2.3.8)
activesupport(3.2.13,2.3.12,2.3.8)
arel(3.0.2)
波旁威士忌(3.0.1)
建造者(3.0.4)
捆绑(1.3.5)
bundler-unload(1.0.1)
康康(1.6.10)
咖啡轨(3.2.2) 咖啡脚本(2.2.0)
coffee-script-source(1.6.2)
commonjs(0.2.6) 守护进程(1.1.9)
delayed_job(3.0.5)
delayed_job_active_record(0.4.4) erubis(2.7.0)
execjs(1.4.0)
formtastic(2.2.1)
formtastic自举 (2.1.3)
haml(4.0.3)
加息(1.2.3)
i18n(0.6.1)
旅程(1.0.4) jquery-rails(3.0.1,2.3.0)
json(1.8.0)
kaminari(0.14.1)
少(2.3.2)
less-rails(2.3.3)
less-rails-fontawesome(0.5.0) libv8(3.11.8.17 x86-linux)
邮件(2.5.4)
meta_search(1.1.3)
哑剧型(1.23)
multi_json(1.7.7)
mysql(2.9.1) mysql2(0.3.11)
多孔的(0.5.0)
多语言(0.3.3)
机架(1.4.5,1.1.6)
rack-cache(1.2)
rack-ssl(1.3.3)
机架测试(0.6.2)
导轨(3.2.13,2.3.8)
铁路(3.2.13)
rake&gt; (10.1.0,10.0.4)
rdoc(4.0.1,3.12.2)
ref(1.0.5)
rubygems-bundler(1.2.0)
rvm(1.11.3.8)
sass(3.2.9)
sass-rails(3.2.6) 链轮(2.2.2)
therubyracer(0.11.4)
托尔(0.18.1)
倾斜(1.4.1)
树梢(1.4.14)
twitter-bootstrap-rails(2.2.7)
tzinfo(0.3.37)
uglifier(2.1.1)
答案 0 :(得分:0)
为什么不为每个项目使用gemsets?
在您的应用内创建一个名为.rvmrc
rvm use --create ruby-x.x.x-version@your_app_name
例如:
rvm use --create ruby-1.9.3-head@your_app_name
现在,当你运行bundle时,它会像我的情况一样分离文件夹:
.rvm/gems/ruby-1.9.3-head@your_app_name
在这种情况下,从一个应用程序切换到另一个应用程序将为您的应用程序加载所需的宝石集。这就像使用RVM在Ruby版本之间切换一样。