Nice programing

Rails 3에서 Rails 3.1로 업그레이드

nicepro 2020. 11. 30. 19:55
반응형

Rails 3에서 Rails 3.1로 업그레이드


Rails 3에서 Rails 3.1 베타로 어떻게 업그레이드하나요?


이것이 기존 rails 3.0.8 프로젝트를 업데이트 할 때 저에게 효과적이었습니다. 귀하의 마일리지가 다를 수 있습니다...

최신 릴리스 후보를 사용하려면 내 Gemfile에 지정된 레일 버전을 업데이트하십시오.

gem 'rails', '3.1.0.rc4’

번들 업데이트 :

bundle update

그런 다음 rake 명령으로 프로젝트를 업데이트합니다.

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/

도움이 되었기를 바랍니다.


Gemfile을 다음과 같이 변경하여 3.0에서 3.1로 업그레이드했습니다.

gem 'rails', '3.1.0.rc1'
gem 'sqlite3'
gem 'sass'
gem 'coffee-script'
gem 'uglifier'

또한 config / environments / development.rb에서 다음 줄을 주석 처리했습니다.

# config.action_view.debug_rjs = true

마지막으로 config / application.rb에서 자산 파이프 라인을 활성화해야합니다.

config.assets.enabled = true

릴리스 노트 http://weblog.rubyonrails.org/2011/4/21/jquery-new-default를 이미 읽었는지 잘 모르겠습니다 .


Rails 3.1로 업그레이드

그것을보십시오 :)


Rails 업그레이드

업데이트 : 레이크가 업그레이드되었으므로 시스템 레이크 사용에주의하십시오.

bundle exec rake

주어진 rails 프로젝트 ( source )에 대해 올바른 갈퀴를 사용하고 있는지 확인합니다.


새로운 앱으로 시작한 다음 특정 앱 정보를 복사하면서 리소스를 새로운 자산 / 스프로킷 형식으로 옮기는 것이 좋습니다.

이전 rails 2.3.4 앱을 3.0으로 변환하는 동안 프로젝트 내에서 한 번에 하나의 파일을 변경하는 동안 충돌이 발생하고 구워졌습니다. 말할 것도없이 그것은 결함이있는 전략 이었지만 나는 그 과정에서 조금 배웠다. 3.0을 건너 뛰고 새로운 앱을 사용하여 3.1beta1로 이동하고 마이그레이션을 올바르게 수행 한 후 내 앱과 공용 폴더를 복사했습니다. 그 움직임에는 몇 가지 눈에 띄는 문제가 있었는데, 가장 중요한 것은 새로운 앱을 만드는 데 rails edge를 사용하지 않았다는 것입니다 (RubyInside 팁 덕분에).

먼저 최신 레일을 참조하기 쉬운 위치에 넣으십시오.

cd ~/goodtimes

git clone https://github.com/rails/rails.git

내 경로에는 ~ / Desktop / Dropbox /가 포함되어 있으므로 내 코드는 어디서나 사용할 수 있습니다.

그런 다음 새 앱을 빌드하려면 해당 rails exec를 참조하십시오.

~/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

I had an issue deploying to Heroku, but theRubyRacer gem helped square that away. Here's an example of a simple Gem file:

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

I suspect there will be community utilities to help you automate migration from older versions of Rails to the --edge.

References:

  1. How to Play with Rails 3.1, CoffeeScript and All That Jazz Right Now
  2. The Four Horsemen of Rails 3.1beta, Coffee-Script, jQuery, SCSS and Assets
  3. Rails 3.1beta deployed to Heroku from your iPhone
  4. Reversible Migrations

I recommend updating your Gemfile to use edge rails. For example:

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'

You can read more here http://pogodan.com/blog/2011/04/24/easy-edge-rails.


http://railscasts.com/episodes/282-upgrading-to-rails-3-1

this railscast might help !


If i understood your question correctly this is how:

gem install rails --pre

This is a pretty good guide which goes into some detail about installing Rails 3.1:

http://railsapps.github.com/installing-rails-3-1.html


Upgrading a rails 3.0.7 and 3.0.9 app using this guide worked for me

http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html

You can skip steps 3 and higher if you want--it will still work, although you won't be taking advantage of everything new in rails 3.1.

참고URL : https://stackoverflow.com/questions/5968131/upgrading-from-rails-3-to-rails-3-1

반응형