如何在Rails中更改/更新gem路径路由

时间:2018-01-27 19:35:33

标签: ruby-on-rails ruby path rubygems

当我运行<div>Employee ID: [[_calculateId(index)]] Name: [[_calculateName(index)]]</div> <button on-click="prev">Previous</button> <button on-click="next">Next</button>on> </template> <script> class MyTest extends Polymer.Element { static get is() { return 'my-test'; } static get properties() { return { index:{ type:Number, value:0 } }} // set this element's employees property constructor() { super(); this.employees = [ { name: 'Bob', id: 'b1' }, { name: 'Ayesha', id: 'b2' }, { name: 'Fatma', id: 'b3' }, { name: 'Tony', id: 'b5' } ]; } _calculateName(i) { return this.employees[i].name } _calculateId (i) { return this.employees[i].id } prev() { console.log("prev"); if (this.index>0) { this.index -= 1 } } next() { console.log("next"); if (this.index < this.employees.length-1){this.index +=1} } } customElements.define(MyTest.is, MyTest); 时,我收到一条错误消息,其中包含此行:

rake db:migrate

但是当查询路径路径时,我得到了不同的路径:

/Users/andy/.rvm/gems/ruby-2.5.0@global/gems/rake-12.3.0/exe/rake:27:in `<top (required)>

寻找一种更改/更新路径路径的方法,这样当我运行rake gem时,它会在Unkle-Andy:workspace andy$ gem which rake /Users/andy/.rvm/gems/ruby-2.5.0/gems/rake-12.3.0/lib/rake.rb 而不是/lib中查找它。或者这是正常的吗?

刚刚在我的计算机上安装了Ruby on Rails。我在Apple计算机上运行Ruby 2.5.0,Rails 5.1.4和rake 12.3.0。我刚刚卸载并重新安装了Rake gem,我仍然遇到同样的错误

1 个答案:

答案 0 :(得分:0)

gem which rake显示的路径的rvm gemset use default部分是正常的;它之前最有可能导致问题 - 错误消息中显示的这条路径和路径指向两个不同的目录,包含不同的RVM gemsets。尝试重置当前的gemset:

rvm gemset use global'bar baz'