반응형
ShakeJ
MNWorld
ShakeJ
전체 방문자
오늘
어제
  • 카테고리 N
    • Contact
    • 🤔그냥이야기
    • 📷사진이야기
    • 제주도에서 한달을 살아보았다
    • 옛글 N
      • 👇Blog
      • 공지사항
      • 이슈 N
      • 생각들
      • 👇취미
      • 건프라
      • 👇Review
      • 노래리뷰
      • 영화리뷰
      • 👇Travel Story
      • 2011 도쿄여행기
      • 2013 Google IO
      • 2013 Jeju
      • 2014 HONGKONG
      • 2014 Jeju
      • 2014 Sanfransis..
      • 2015 Lombok
      • 2016 HONGKONG
      • 2017 Saigon
      • 국내여행기
      • Photo Story
      • Growth
      • 👇Server
      • Ruby on the Rai..
      • Frontend
      • FullStack (MEAN..
      • Ubuntu
      • 👇Android
      • 안드로이드 프로그래밍
      • 번역본
      • 내어플이야기
      • 코드창고
      • 👇iOS
      • 아이폰 프로그래밍
      • 맥북 이야기
      • 👇Microsoft
      • ASP.NET
      • Silverlight
      • 윈도우 이야기
      • 👇IT Story
      • 모바일 이야기
      • 하드웨어 이야기 N
      • 네트워크 이야기
      • 프로그래밍이야기
      • Database이야기
      • 클라우드이야기
      • 프론트 이야기
      • 마케팅이야기
      • 그래픽 작업
      • 블로그 팁

블로그 메뉴

  • GuestBook

공지사항

인기 글

태그

  • 안드로이드 어플 추천
  • 블로그 처음
  • 배너교환
  • 블로그 시작하기
  • 블로그 운영
  • 블로그 운영하면서
  • 초대장
  • shakej
  • iOS 프로그래밍
  • 배너무료제작
  • 티스토리
  • 블로그 초보
  • 블로그 만들기
  • 무료배너제작
  • MNWorld
  • 블로그 이야기
  • 블로그 운영하기
  • 서울 출사지
  • 윈도우폰7
  • 블로그 잡담
  • 티스토리 초대장
  • 배너제작
  • 풍경사진
  • 블로그 팁
  • 티스토리 팁
  • D40 사진
  • asp.net
  • 블로그 관련
  • 랩
  • 블로그 꾸미기

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
ShakeJ

MNWorld

Rails upgrade 5.2 to 6.0
옛글/Ruby on the Rails

Rails upgrade 5.2 to 6.0

2019. 5. 24. 21:33
반응형

Rails 5.2.0 to 6.0.0 

* 6.0 에서 ActionText를 사용할 수 있다! 흥미로움

 

1. Rails 6은 Ruby 2.5.0 이상 버전에서 동작 

2. rails app:update 를 실행

3. config.load_defaults in config/application.rb 변경하기 

 

config.load_defaults 6.0

 

application.rb에 Rails.autoloaders.logger = method(:puts) 입력 시 레일즈 시작할때 autoloads되는 것들을 볼 수 있음. 


https://edgeguides.rubyonrails.org/6_0_release_notes.html

 

Ruby on Rails 6.0 Release Notes — Ruby on Rails Guides

Ruby on Rails 6.0 Release NotesHighlights in Rails 6.0: Action Mailbox Action Text Parallel Testing Action Cable Testing These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the change logs or chec

edgeguides.rubyonrails.org

https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#common-gotchas

 

Autoloading and Reloading Constants — Ruby on Rails Guides

Ruby on Rails allows applications to be written as if their code was preloaded. In a normal Ruby program classes need to load their dependencies: require 'application_controller' require 'post' class PostsController < ApplicationController def index @posts

guides.rubyonrails.org

 

원인을 찾는 중 

 

상속관계
ApplicationController (get_current_user)
AdminController (before_action: verify_admin 내에서 ApplicationController의 get_current_user 호출 불가)

BController  

....대체 왜 6.0에서는 불가능한것이지?
원인은 찾음. 6.0부터는 autoloading 방식이 :zeitwerk이 기본
(방식에는 :zeitwerk and :classic 두가지가 존재하는데, 6.0 이전에는 :classic 방식을 사용했었음)
만약 서비스 중인 어플리케이션이라면, application.rb 에 config.autoloader = :classic으로 세팅 후 사용하는 것이 나을 듯 
zeitwerk autoload 방식은 https://mnworld.co.kr/1909 으로 업데이트 중

 

https://weblog.rubyonrails.org/2019/2/22/zeitwerk-integration-in-rails-6-beta-2/

 

Zeitwerk integration in Rails 6 (Beta 2)

The second beta of Rails 6 is about to ship, and includes Zeitwerk integration.

weblog.rubyonrails.org

https://github.com/fxn/zeitwerk/issues/19

 

eager_load difference between autoloader classic, bug or feature? · Issue #19 · fxn/zeitwerk

Hi, I noticed that when I used config.eager_load=true or ran the Jumpstart template in production which overrides the Devise helper https://github.com/excid3/jumpstart/blob/c6c0de0a9493c617297746eb...

github.com

https://medium.com/@fxn/zeitwerk-a-new-code-loader-for-ruby-ae7895977e73

 

Zeitwerk: A new code loader for Ruby

This post presents Zeitwerk: A new code loader for Ruby in which I have been working during the last months.

medium.com

skip_before_action :verify_authenticity_token 이슈도 살펴봐야 함

 

수정 시 puma가 controller 로딩 못하는 상황 

begin
  load File.expand_path('../spring', __FILE__)
rescue LoadError => e
  raise unless e.message.include?('spring')
end

bin/rails에 추가 



model에 override된 메서드가 동작을 안함..

-> https://github.com/rails/rails/issues/36100

-> https://github.com/rails/rails/issues/35749

 

Zeitwerk breaks override pattern · Issue #36100 · rails/rails

Steps to reproduce Follow https://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers create an override (monkey patch) for a class This works before 6.0.0.rc1 (including 6.0....

github.com

Override 이슈 -> 해당이슈도 https://mnworld.co.kr/1909에서 같이 정리 중.

 

그 외,

features.where(awesomeness: 10..) 와 같이 endless ranges가 가능
bin/rails db:system:change --to=postgresql 명령어를 쓰면 sqlite에서 postgresql로 바로 변경이 가능 

반응형

'옛글 > Ruby on the Rails' 카테고리의 다른 글

DB의 index와 rails가 기억하는 index가 틀려 duplicate 에러가 나는 경우  (1) 2020.10.22
Rails autoloader :zeitwerk 방식 *업데이트 중  (0) 2019.05.27
Mac Postgres install and command  (0) 2019.03.27
Rails 구글 크롬 노티피케이션(푸쉬) FCM(Firebase)로 붙이기  (0) 2017.10.13
[Ruby on rails] ElasticSearch 를 붙여보자  (0) 2017.04.14
    추천글👇
    • [📷사진이야기] 붉은 호치민의 노을
    ShakeJ
    ShakeJ

    티스토리툴바