如何從Rails 3升級到Rails 3.1 beta?從Rails 3升級到Rails 3.1
回答
如果我理解你的問題正確,這是多麼:
gem install rails --pre
看它:)
會覆蓋舊的rails項目嗎? – user730569 2011-05-11 17:53:46
我認爲你不能更新舊的項目,你應該生成新的項目 – bor1s 2011-05-11 18:30:45
Railscasts是獲得關於Rails信息的最佳站點之一,感謝Ryan Bates! – bor1s 2011-05-11 18:44:10
我建議您更新Gemfile中使用邊緣軌道。例如:
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'arel', :git => 'git://github.com/rails/arel.git'
gem 'rack', :git => 'git://github.com/rack/rack.git'
gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git'
gem 'sqlite3'
# Asset template engines
gem 'sass', '~> 3.1.0.alpha'
gem 'coffee-script'
gem 'uglifier'
您可以在這裏閱讀更多http://pogodan.com/blog/2011/04/24/easy-edge-rails。
你的鏈接缺少一個0.應該是:http://pogodan.com/blog/2011/04/24/easy-edge-rails – 2011-06-03 23:46:46
升級的Rails
更新:謹慎使用系統耙,耙作爲已經升級。
bundle exec rake
確保你使用正確耙對於給定軌項目(source)
我建議用新的應用開始,然後在您的應用程序特定信息的複製,而換擋你的資源轉換爲新的資產/鏈輪格式。
An example
While converting an older rails 2.3.4 app to 3.0 I crashed and burned while changing one file at a time over within the project. Needless to say that was a flawed strategy, but I did learn a little along the way. I ended up skipping 3.0 and moving to 3.1beta1 with a fresh app, and copied my app and public folders in after getting the migrations right. That move had a couple of outstanding issues, the most important being that I didn’t use rails edge for creating the new app (thanks for the tip RubyInside).
First snag the latest rails into an easy to reference location:
cd ~/goodtimes
git clone
https://github.com/rails/rails.git
My path includes a ~/Desktop/Dropbox/ so my code is available everywhere.
Then refer to that rails exec for building a new app:
~/goodtimes/rails/bin/rails new bacon --edge
根據你的數據庫的複雜性,你要麼想用改變語法來創建新的遷移或離開他們是:
class CreatePosts < ActiveRecord::Migration def change create_table :posts do |t| t.string :title t.text :body t.timestamps end end end
我不得不部署到Heroku的一個問題,但theRubyRacer寶石幫助消除了這一點。這裏有一個簡單的寶石文件的例子:
source 'http://rubygems.org'
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Asset template engines
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
gem 'pg'
gem 'therubyracer-heroku', '0.8.1.pre3', :platforms => :ruby
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
我懷疑會有社區工具來幫助您從到--edge舊版本的Rails的自動遷移。
參考文獻:
我剛剛從3.0改變我的Gemfile以升級到3.1:
gem 'rails', '3.1.0.rc1'
gem 'sqlite3'
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
我也是在配置/環境/ development.rb註釋掉以下行下方
# config.action_view.debug_rjs = true
最後,確保你能夠在配置/應用程序資產的管道。RB
config.assets.enabled = true
我不知道,如果您已經閱讀發行說明http://weblog.rubyonrails.org/2011/4/21/jquery-new-default
那是唯一真正回答的人。 railscasts插曲很棒,但沒有說明如何遷移。 – 2011-05-31 22:05:03
我會注意到'rc5'的Gemfile看起來有些不同;它會安裝'sass-rails'和'coffee-rails',兩個版本都是'3.1.0.rc1',並將這些寶石(和'uglifier'一起)放在一個「group:assets do/end'塊中。它有助於在另一個目錄中生成一個新的邊緣Rails站點,以查看它添加的內容。 – 2011-07-29 15:57:05
這是更新現有的軌道3.0.8項目時什麼爲我工作。你的情況可能會有所不同...
更新我的Gemfile中指定的軌道版本使用最新發布候選:
gem 'rails', '3.1.0.rc4’
更新包:
bundle update
然後更新與項目耙子命令:
rake rails:update
雖然櫻桃採摘雖然變化衝突我跑了我的測試,他們通過(耶!)。我重新啓動了服務器,目前爲止一切都很順利。
但是,這還沒有使用新的資產管道。由此我的意思是javascript和css(或sass)文件仍然以前置處理方式處理。據我瞭解,這是一個完全可行的選擇。但是,當然,我希望獲得新的好處,所以我相信接下來的步驟是包括額外的gem(例如coffeescript,sass,uglifier等),然後將舊文件遷移到app/assets目錄。
我發現有關的一些細節在這裏:
http://blog.nodeta.com/2011/06/14/rails-3-1-asset-pipeline-in-the-real-world/
希望這是有幫助的。
如果您只想更新包中的導軌特定寶石,您可以執行「捆綁更新導軌」。 – 2011-07-26 21:47:08
工作就像一個魅力!但是,啓用資產時,出現以下錯誤:'沒有路由匹配[GET]/assets/application.css' – 2011-08-31 22:50:38
這是一個很好的指南,進入一些細節有關安裝的Rails 3.1:
升級軌3.0.7和3.0.9的應用程序中使用本指南爲我工作
http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html
如果你願意,你可以跳過第3步和更高的步驟 - 它仍然可以工作,儘管你不會利用rails 3.1中的所有新功能。
http://railscasts.com/episodes/282-upgrading-to-rails-3-1
這個railscast可能有幫助!
- 1. 從Rails 3升級到Rails 3陷阱
- 2. 升級時到Rails 3.1
- 3. 從Rails 3.1升級到3.2錯誤
- 4. 從CanCan升級到Rails 3.0.9到Rails 3.1錯誤
- 5. 問題升級到Rails 3
- 6. RoutingError在JavaScript文件夾從Rails的3.1升級後到Rails 3.2
- 7. rails 3.1從3.0升級。渲染錯誤。
- 8. 的JQuery的ajaxSuccess不升級到Rails 3.1
- 9. gravatar_image_tag在升級到Rails 3.1後休息
- 10. Rails 3.1升級到3.2.6 - asset_sync錯誤
- 11. 從rails 3.1降級到3.0.9
- 12. 我從rails rails(4.1.8)升級到rails 4.2.5.1
- 13. 將rails 3升級到3.1 - ajax請求不起作用
- 14. 爲什麼在升級到Rails 3.1之後,Rails 3 AREL線沒有問題?
- 15. 從Rails 3.0升級到3.1,然後升級到3.2 - 但保持3.0工作
- 16. 從Rails 3.2升級到Rails 4
- 17. 從Rails 4升級到Rails 5
- 18. 如何從rails 4.2.6升級到rails 5.0
- 19. 從Rails 2.3升級到Rails 3 - 時區問題
- 20. 如何將Rails 3.0應用程序升級到Rails 3.1?
- 21. Rails 3延遲工作 - 升級到Rails 3中斷delayed_job任務
- 22. Rails 3.1升級後的ActionView :: MissingTemplate
- 23. 升級到Rails 3的時間?
- 24. 從rails 3.1升級到3.2.6後出現錯誤
- 25. Rails升級到3.1 - 將ajax處理從「render:update」更改爲respond_to
- 26. 升級到Rails 3.0
- 27. Rails 3升級後rake db:test:prepare not working?
- 28. 無法升級到rails 5
- 29. Requirejs-rails阻止升級到rails 4
- 30. Rails 3中的路由(從rails 2升級)
http://everydayrails.com/2011/05/08/rails-3.1-beta-rvm.html – 2011-05-11 17:26:30
我在@ user730569下面給出了一些例子。我正在將rails 2.3.4應用程序遷移到3.1 beta版 – 2011-05-17 21:57:52
剛剛將我的應用程序從3更新到3.1 - 記錄它[這裏](http://webtempest.com/upgrade-rails-3-to-3-1/) – Plattsy 2011-09-06 04:33:39