# 20210302(화)

## 2021-03-02

### 1. 학습 날짜

* 2021-03-02

### 2. 학습 시간

* 11:00 \~ 23:00

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

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

### 4. 학습 목표

* PR 수정 및 PR 확인

### 5. 학습 정리

* [루비 문자열 검사 - 정규표현식](https://simian114.gitbook.io/blog/undefined/rubyonrails/undefined-5)

### 6. 상세 학습 내용

* 구현하고 PR 하고.. PR 리뷰했다. 팀원분께서 rspec 을 이용해서 모델, 컨트롤러 테스트를 진행했는데, 아직 잘 이해는 가지 않는다.
* validates 로 문자열 검사하는법에 대해서 학습했다. 기존 같으면 custom validate 를 만들어서 했겠지만 `format` 을 사용하면 `validates` 에서도 문자열 자체를 검사할 수 있게 된다.
* 일단 기존의 `check_anagram` 에서 사용한 `match(regex)` 와는 조금 다른게 여기서는 문자열 시작, 문자열 종료에 대한 알림을 줘야한다. 아직 그 이유는 모른다.
* 따라서 아래처럼 하면 된다.

```
validates :name, format: { with: /\A[[:alnum:]]+\z/, message: "hahah" }
```

* 여기서 주의할 건 `\A` 와 `\z`. 시작과 끝을 의미한다.
* 뒤에 나오는 `message` 를 지정해주면 후에 여기서 걸렸을 경우 `haha`가 출력된다.

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

* 후... 오늘은 집중을 잘한편인거 같다... 내일도 열심히 해야겠다!

### 8. 다음 학습 계획

* guild\_create 만들기


---

# 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/march/20210302.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.
