# 20210226(금)

## 2021-02-26

### 1. 학습 날짜

* 2021-02-26

### 2. 학습 시간

* 11:00 \~ 02:15

### 3. 학습 범위 및 주제

* 백본 view, model, collection
* 루비온레일즈

### 4. 학습 목표

* PR 수정 및 PR 확인

### 5. 학습 정리

* [git 학습](https://simian114.gitbook.io/blog/undefined/undefined/git/git-remote-update-remote)
* [priority 정렬 - CASE 이용](https://simian114.gitbook.io/blog/undefined/rubyonrails/case-x)

### 6. 상세 학습 내용

* 하루종일 PR 수정했다... 머리가 아프다.
* 일단 학습한? 내용은 두 가지인데, rails 에서 CASE 를 이용해서 정렬하는 법과 git 의 새로운 사용법이다.
* rails에서 작업할 때 모델의 레코드들을 정렬해야 하는 상황이 있었는데 기존에는 id, date 와 같은 정렬할 수 있는 값들을 정렬하는 거였지만 오늘은 class 별로 정렬해야하는 상황이었다.
  * 시간이 얼마걸리지 않을줄 알았는데 생각보다 많은 시간을 소모한 이슈였다.
  * 그리고 많은 해결법이 있었지만 대부분의 경우 사용할 수 없었는데, 레일즈 버전 문제 때문이었다.
  * 어쨌든 최신버전에서 사용할 수 있는 방법은 아래와같다.

```
def self.priority_order
  self.order(
    # A Relational Algebra
    Arel.sql(<<-SQL.squish
      CASE
      WHEN position = 'master' THEN '1'
      WHEN position = 'officer' THEN '2'
      WHEN position = 'member' THEN '3'
      END
      SQL
      )
    )
end
```

* 최신버전에서는 `Arel.sql ...` 와 같은 문구가 필요하다. 이유는 알아보지 않으련다....
* git remote update
  * 가끔 다른 팀원의 브랜치를 가져와서 작업해야하는 경우가 있다. 그런데 그 브랜치가 과거라면 어떻게 해야하는가
  * 이 때 사용하는게 `git remote update`

### 7. 오늘 학습 내용에 대한 개인적인 총평

* 흠.. 난 너무 멍청하다.. 신중에 신중을 기하지 못하고 있다. 점점 신뢰을 잃어가고 있는 느낌이다.

### 8. 다음 학습 계획

* guild\_detail  뷰 수정


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://simian114.gitbook.io/blog/undefined-1/diary/2021/february/20210226.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
