4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Spree:: Taxonのカラムを解説

Last updated at Posted at 2020-10-25

solidus使っていると初心者にとっては「。。。ん?」みたいな状態ですよね。
この記事を読まれていると言うことは少し全体像が掴めて、「Spree::Taxon」にはどう言ったカラムが存在するんだ?」と言うところなのかなと思います。:point_up:
そこで今回は「Spree::Taxon」内のカラムについて簡潔に紹介と説明をしていきます。

Solidusのバージョン

solidus 2.0.9

カラムの紹介と説明

Spree::Taxonのid=1をのぞいてみましょう。
スクリーンショット 2020-10-25 19.05.59.png

それではここにあるカラムについて説明します。

id

id。

parent_id

スクリーンショット 2020-10-25 22.37.52.png
例えばこのような入れ子構造になっていた場合、以下のtaxonのparent_idをそれぞれ示します。
Category ▶︎ parent_id:nil
Clothing,Shoes ▶︎ parent_id:1
T-shirts,Shirts,Socks ▶︎ parent_id:2
Boots,Sandals,Sneakers ▶︎ parent_id:3
つまり、その商品が所属する一つ上のtaxonのid。

position

画像リスト中のImageの配置場所を設定する。
例として,「2」の値では,「1」の値の後で表示される。

name

分類(taxon)名。

permalink

その商品のtaxon内でのurl。

taxonomy_id

スクリーンショット 2020-10-25 22.41.42.png
所属するtaxonomyのid。
Clothing,Shoesを含めそれ以下 ▶︎ taxonomy_id:1(Category)
NIKE,Ferrari,GUUCI ▶︎ taxonomy_id:2(Brands)

lft

商品の階層構造の中にある位置。
awesome_nested_set-Gem参照。

rgt

商品の階層構造の中にある位置。
awesome_nested_set-Gem参照。

icon_file_name

調査中。

icon_content_type

調査中。

icon_file_size

調査中。

icon_updated_at

調査中。

description

分類(taxon)紹介文。

create_at

分類(taxon)が作られた時間。

update_at

分類(taxon)が更新された時間。

meta_title

HTMLのタグ。空の場合はnameが使用される。

meta_description

SEO用で、サーチエンジン向けの説明。

meta_keywords

SEO用で、サーチエンジン向けのキーワード。

depth

そのtaxonの所属するディレクトリの深さ。
例えば
Category,Brands ▶︎ depth:0>
Clothing,Shoes,NIKE,Ferrari,GUCCI ▶︎ depth:1>

<関連情報>
Spree::Productのカラムを解説
https://qiita.com/roooll12/items/92b370741a53c8dd268c

Spree::Taxonomyのカラムを解説
https://qiita.com/roooll12/items/8b788e01309f0593934b

駆け出しsolidus開発者にとってSpree::Taxonモデルを理解する糧になれば幸いです!

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?