---
# System prepended metadata

title: 2023-04-21 Rails
tags: [Ruby on Rails]

---

# 2023-04-21 Rails
###### tags: `Ruby on Rails`

## ransack
> rubygem

## elasticsearch-rails
> rubygem

## searchkick
> rubygem

## rdbms vs nosql

## melisearch
> 較好的elasticsearch

## 多層 comment
### 自我參照

```ruby=
# Comment
has_many :replies, class_name: 'Comment', foreign_key: 'reply_id'
```

## eager loading
> 解決 N + 1 使用 IN (xx, yy, zz)

## rspec
```bash
$ bundle add rspec-rails
$ rails generate rspec:install
```

### 哪些可以用
```bash
$ rails g
```

:::info
```bash
Rspec:
  rspec:channel
  rspec:controller
  rspec:feature
  rspec:generator
  rspec:helper
  rspec:install
  rspec:integration
  rspec:job
  rspec:mailbox
  rspec:mailer
  rspec:model
  rspec:request
  rspec:scaffold
  rspec:system
  rspec:view
```
:::

## scenario

## factory_bot

## 書
* rspec everyday
* pragmatic bookshelf(書商)
* packt(書商)

## AWS/Lindo/DigitalOcean/fly.io/heroku

## gandi
https://www.gandi.net/zh-Hant

## CI/CD
### github actions

### private docker registry
> 非公開的

### gitlab flow

### jenkins

## github lydia
> 面試題

## javascript
### tag template function
```javascript=
tagFucnction`string text ${xxx} yyy`
```

