# 20210222(월)

## 2021-02-22

### 1. 학습 날짜

* 2021-02-21

### 2. 학습 시간

* 08:30 \~ 21:00

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

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

### 4. 학습 목표

* PR 수정 및 PR 확인

### 5. 학습 정리

* [루비 컬렉션 map에서 continue](https://simian114.gitbook.io/blog/undefined/rubyonrails/map)
* [레일즈 wrap-parameter](https://simian114.gitbook.io/blog/undefined/rubyonrails/wrap-parameter-body)

### 6. 상세 학습 내용

* PR 리뷰를 수정했다.
* 전체적으로 크게 학습하고 수정한 내용은 없고 일부분에 대해서 리팩토링을 진행했다.
  * 진행중에 조금은 재밌는걸 발견했는데 프론트에서 백엔드로 데이터를 post 로 전송하면 데이터가 두 번씩 전달되는 것.&#x20;
  * 하지만 특정 데이터만 그렇게 되고 어떤 데이터에 대해서는 두번씩 보내지지 않았다.
  * 따라서 여기서 유추해 볼수있는게 이름 규칙에 따라서 레일즈가 찰떡같이 동작한다는것.
  * 이 생각을 가지고 검색을 해보니깐 역시나 내 생각이 맞았다.
    * 이 기능을 레일즈에서는 `wrap-parameter` 이라고 한다. 특정 데이터를 body로 담아서 쏘면 백엔드에서는 이걸 컨트롤러, 모델과 비교해서 만약 존재하는 컬럼이라면 해당 모델의 이름으로 한꺼풀 감싸주는 기능
* 루비 map에 조건걸기
  * 루비 컬렉션에서 map 을 사용하면 모든 요소를 돌면서 작업을 수행한다.
  * 다만 특정 조건이 있고 조건을 만족하지 않으면 해당 값에 map을 적용시키면 안된다고 해보자.
  * 일반적인 반복문이라면 continue를 사용하면 되겠지만 안타깝게도 map 에는 continue 가 없다. 따라서 다른 방법을 찾아야했는데 발견한게 바로 `reject` 다. reject 를 사용하면 특정 조건에 해당하는 값에는 map 을 적용시키지 않으면서 자기에 해당하는 값에 원하는 함수를 걸 수 있게 된다.

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

* 너무 졸려서 늦게까지하지는 못했다. 어떻게 코드를 짜는 것보다 PR 리뷰에 더 시간이 많이 들어가는 것 같다..

### 8. 다음 학습 계획

* guild index 뷰 PR 마무리, group\_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/20210221.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.
