ONE_LINE
jsonb
https://nandovieira.com/using-postgresql-and-jsonb-with-ruby-on-rails
jsonb = [1]avoids reparsing, [2]supports indexing, [3] no key ordering
hstore = [1]not allow a nested structure, [2]store as strings, require type coercion
jsonb is better than hstore
PSQL search
index = [1]use b tree, [2]avoid sequential scan
GIN (Generalized Inverted Index) = [1]use for array or hash, [2] build value -> where
Delete
& destroy
for association
Delete
& destroy
for associationdelete 沒有
dependent: :destroy
只清空*_id
delete 有
dependent: :destroy
皆刪除recorddestroy 不論有無
dependent: :destroy
皆刪除record
destroy(*id)
destroy_all()
Last updated
Was this helpful?