Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Railsアップグレード

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 Railsアップグレード

Avatar for KishiKyosuke(Kyo18)

KishiKyosuke(Kyo18)

November 18, 2022
Tweet

More Decks by KishiKyosuke(Kyo18)

Other Decks in Programming

Transcript

  1. ᶃ RailsҎ֎ͷgemͷΞοϓσʔτ ◦ΞϓϦέʔγϣϯ΁ͷӨڹΛߟྀ͠ͳ͕ΒgemΛΞοϓσʔτ ˈ bundle update -g development -g test

    ˈ bundle update devise ˈ bundle update developmentͱtestάϧʔϓͷgemͷΞοϓσʔτ Өڹͷେ͖ͦ͏ͳgemͷݸผΞοϓσʔτ ࢒͍ͬͯΔgemΛҰׅΞοϓσʔτ 5FTU 5FTU
  2. ᶄ RailsͷύονόʔδϣϯΛ࠷৽ʹΞοϓάϨʔυ ˈ bundle update rails -gem 'rails', '5.2.2' +gem

    'rails', '5.2.4' Gem fi leͷrailsόʔδϣϯࢦఆΛมߋ railsͷΞοϓάϨʔυΛ࣮ߦ
  3. ᶅ RailsͷϝδϟʔόʔδϣϯͷΞοϓάϨʔυ ˈ bundle update rails -gem 'rails', '5.2.4' +gem

    'rails', '6.0.3' Gem fi leͷrailsόʔδϣϯࢦఆΛมߋ railsͷΞοϓάϨʔυΛ࣮ߦ
  4. ᶅ RailsͷϝδϟʔɾϚΠφʔόʔδϣϯͷΞοϓάϨʔυ $ rails app:update identical config/boot.rb exist config conflict

    config/routes.rb Overwrite /myapp/config/routes.rb? (enter "h" for help) [Ynaqdh] force config/routes.rb conflict config/application.rb Overwrite /myapp/config/application.rb? (enter "h" for help) [Ynaqdh] force config/application.rb conflict config/environment.rb ... Overwrite /myapp/config/application.rb? (enter "h" for help) [Ynaqdh] Y=> ্ॻ͖࣮ߦ, n => ্ॻ͖͠ͳ͍, a => ͜ͷϑΝΠϧҎ߱͢΂্ͯॻ͖, q => தஅ, d => ৽چϑΝΠϧͷdi f Λදࣔ, h => ϔϧϓͷදࣔ
  5. ᶅ RailsͷϝδϟʔɾϚΠφʔόʔδϣϯͷΞοϓάϨʔυ ◦ ৽͍͠όʔδϣϯͰσϑΥϧτͱͳͬͨgemͷ௥Ճ → http://railsdiff.org ͷgem fi leΛ֬ೝͯ͠Πϯετʔϧ ◦

    RailsΞοϓάϨʔυΨΠυ΍ϦϦʔεϊʔτΛಡΉ →ඇਪ঑ͱͳͬͨॻ͖ํ΍ɺॏཁͳมߋ఺Λ೺Ѳ͓ͯ͘͠
  6. ᶆ RubyͷόʔδϣϯΞοϓάϨʔυ -ruby '2.6.4' +ruby '3.0.0' Gem fi leͷrubyόʔδϣϯࢦఆΛมߋʢ.ruby-versionϑΝΠϧ΋ʣ ˈ

    rbenv local 3.0.0 ˈ bundle install rbenvͰ࢖༻͢ΔrubyͷόʔδϣϯΛมߋ gemΛ࠶Πϯετʔϧ
  7. ໰୊ͷൃݟ def inde x @dictionaries_grid = initialize_grid(Dictionary , :conditions =>

    ["public = ?", true] , :order => 'created_at' , :order_direction => 'desc' , :per_page => 2 0 ) respond_to do |format | format.html # index.html.er b format.json { render json: dics } en d en d FrozenError (can't modify frozen ActiveRecord::ConnectionAdapters::PostgreSQL::Column ~)
  8. def init_columns_of_table(model) #:nodoc : self[model] = HashWithIndifferentAccess.new(model.columns.index_by(&:name) ) @by_table_names[model.table_name] =

    self[model ] self[model].each_value { |c| c.model = model } end lib/wice/table_column_matrix.rb FrozenError (can't modify frozen ActiveRecord::ConnectionAdapters::PostgreSQL::Column ~) →freeze͞ΕͨΧϥϜΦϒδΣΫτʹ มߋΛՃ͑Α͏ͱ͍ͯ͠Δ͜ͱ͕ݪҼͰΤϥʔൃੜ ݪҼͷಛఆ