Ruby on Railsでメルカリクローンを作ろう!【カテゴリ編】です。
トップページデザイン編ではカテゴリが静的にHTMLで書かれていたのですが、こちらをデータベースから取得して動的に表示するように変更しました。
目次
作業リポジトリ
サポートが必要な方
tom@エンジニア (@tomoya_y0shida) | Twitter
までDMください。
動画
実際に私が作業した動画はこちらになります。
現役エンジニアの実際の作業風景ですので、参考になると思います。
カテゴリモデルの追加
カテゴリモデルを作成します。
docker-compose run --rm web bin/rails g model Category name
migrationファイルの修正
nullを許容しないようにmigrationファイルを修正します。
class CreateCategories < ActiveRecord::Migration[6.0] def change create_table :categories do |t| t.string :name, null: false t.timestamps end
migrationの反映
docker-compose run --rm web bin/rails db:migrate
ancestryの追加
カテゴリは木構造(階層構造)にしたいので、gemを使用します。
gemのinstall
$ docker-compose run --rm web bundle install
カテゴリモデルに適用
カテゴリモデルでancestryを使用できるようにカラムを追加します。
docker-compose run --rm web bin/rails g migration add_ancestry_to_categories ancestry:string:index
migrationの反映
docker-compose run --rm web bin/rails db:migrate
カテゴリモデルに適用
カテゴリモデルでancestryを使用できるようにincludeします。
class Category < ApplicationRecord has_ancestry end
seedデータの投入
seed-fuというgemでデータを投入します。
Gemfile
gem 'seed-fu'
installします。
docker-compose run --rm web bundle install
seedデータの作成
seed-fuはdb/fixtures以下に作成したファイルを自動的に読み込みます。
db/fixtures/categories.rb
# DO NOT MODIFY THIS FILE, it was auto-generated. # # Date: 2020-04-13 05:05:13 +0000 # Seeding Category # Written with the command: # # rails_console # Category.seed(:id, {:id=>1, :name=>"レディース", :ancestry=>nil}, {:id=>2, :name=>"メンズ", :ancestry=>nil}, {:id=>3, :name=>"ベビー・キッズ", :ancestry=>nil}, {:id=>4, :name=>"インテリア・住まい・小物", :ancestry=>nil}, {:id=>5, :name=>"本・音楽・ゲーム", :ancestry=>nil}, {:id=>6, :name=>"おもちゃ・ホビー・グッズ", :ancestry=>nil}, {:id=>7, :name=>"コスメ・香水・美容", :ancestry=>nil}, {:id=>8, :name=>"家電・スマホ・カメラ", :ancestry=>nil}, {:id=>9, :name=>"スポーツ・レジャー", :ancestry=>nil}, {:id=>10, :name=>"ハンドメイド", :ancestry=>nil}, {:id=>11, :name=>"チケット", :ancestry=>nil}, {:id=>12, :name=>"自動車・オートバイ", :ancestry=>nil}, {:id=>13, :name=>"その他", :ancestry=>nil}, {:id=>14, :name=>"トップス", :ancestry=>"1"}, {:id=>15, :name=>"ジャケット/アウター", :ancestry=>"1"}, {:id=>16, :name=>"パンツ", :ancestry=>"1"}, {:id=>17, :name=>"スカート", :ancestry=>"1"}, {:id=>18, :name=>"ワンピース", :ancestry=>"1"}, {:id=>19, :name=>"靴", :ancestry=>"1"}, {:id=>20, :name=>"ルームウェア/パジャマ", :ancestry=>"1"}, {:id=>21, :name=>"レッグウェア", :ancestry=>"1"}, {:id=>22, :name=>"帽子", :ancestry=>"1"}, {:id=>23, :name=>"バッグ", :ancestry=>"1"}, {:id=>24, :name=>"アクセサリー", :ancestry=>"1"}, {:id=>25, :name=>"ヘアアクセサリー", :ancestry=>"1"}, {:id=>26, :name=>"小物", :ancestry=>"1"}, {:id=>27, :name=>"時計", :ancestry=>"1"}, {:id=>28, :name=>"ウィッグ/エクステ", :ancestry=>"1"}, {:id=>29, :name=>"浴衣/水着", :ancestry=>"1"}, {:id=>30, :name=>"スーツ/フォーマル/ドレス", :ancestry=>"1"}, {:id=>31, :name=>"マタニティ", :ancestry=>"1"}, {:id=>32, :name=>"その他", :ancestry=>"1"}, {:id=>33, :name=>"トップス", :ancestry=>"2"}, {:id=>34, :name=>"ジャケット/アウター", :ancestry=>"2"}, {:id=>35, :name=>"パンツ", :ancestry=>"2"}, {:id=>36, :name=>"靴", :ancestry=>"2"}, {:id=>37, :name=>"バッグ", :ancestry=>"2"}, {:id=>38, :name=>"スーツ", :ancestry=>"2"}, {:id=>39, :name=>"帽子", :ancestry=>"2"}, {:id=>40, :name=>"アクセサリー", :ancestry=>"2"}, {:id=>41, :name=>"小物", :ancestry=>"2"}, {:id=>42, :name=>"時計", :ancestry=>"2"}, {:id=>43, :name=>"水着", :ancestry=>"2"}, {:id=>44, :name=>"レッグウェア", :ancestry=>"2"}, {:id=>45, :name=>"アンダーウェア", :ancestry=>"2"}, {:id=>46, :name=>"その他", :ancestry=>"2"}, {:id=>47, :name=>"ベビー服(女の子用) ~95cm", :ancestry=>"3"}, {:id=>48, :name=>"ベビー服(男の子用) ~95cm", :ancestry=>"3"}, {:id=>49, :name=>"ベビー服(男女兼用) ~95cm", :ancestry=>"3"}, {:id=>50, :name=>"キッズ服(女の子用) 100cm~", :ancestry=>"3"}, {:id=>51, :name=>"キッズ服(男の子用) 100cm~", :ancestry=>"3"}, {:id=>52, :name=>"キッズ服(男女兼用) 100cm~", :ancestry=>"3"}, {:id=>53, :name=>"キッズ靴", :ancestry=>"3"}, {:id=>54, :name=>"子ども用ファッション小物", :ancestry=>"3"}, {:id=>55, :name=>"おむつ/トイレ/バス", :ancestry=>"3"}, {:id=>56, :name=>"外出/移動用品", :ancestry=>"3"}, {:id=>57, :name=>"授乳/食事", :ancestry=>"3"}, {:id=>58, :name=>"ベビー家具/寝具/室内用品", :ancestry=>"3"}, {:id=>59, :name=>"おもちゃ", :ancestry=>"3"}, {:id=>60, :name=>"行事/記念品", :ancestry=>"3"}, {:id=>61, :name=>"その他", :ancestry=>"3"}, {:id=>62, :name=>"キッチン/食器", :ancestry=>"4"}, {:id=>63, :name=>"ベッド/マットレス", :ancestry=>"4"}, {:id=>64, :name=>"ソファ/ソファベッド", :ancestry=>"4"}, {:id=>65, :name=>"椅子/チェア", :ancestry=>"4"}, {:id=>66, :name=>"机/テーブル", :ancestry=>"4"}, {:id=>67, :name=>"収納家具", :ancestry=>"4"}, {:id=>68, :name=>"ラグ/カーペット/マット", :ancestry=>"4"}, {:id=>69, :name=>"カーテン/ブラインド", :ancestry=>"4"}, {:id=>70, :name=>"ライト/照明", :ancestry=>"4"}, {:id=>71, :name=>"寝具", :ancestry=>"4"}, {:id=>72, :name=>"インテリア小物", :ancestry=>"4"}, {:id=>73, :name=>"季節/年中行事", :ancestry=>"4"}, {:id=>74, :name=>"その他", :ancestry=>"4"}, {:id=>75, :name=>"本", :ancestry=>"5"}, {:id=>76, :name=>"漫画", :ancestry=>"5"}, {:id=>77, :name=>"雑誌", :ancestry=>"5"}, {:id=>78, :name=>"CD", :ancestry=>"5"}, {:id=>79, :name=>"DVD/ブルーレイ", :ancestry=>"5"}, {:id=>80, :name=>"レコード", :ancestry=>"5"}, {:id=>81, :name=>"テレビゲーム", :ancestry=>"5"}, {:id=>82, :name=>"おもちゃ", :ancestry=>"6"}, {:id=>83, :name=>"タレントグッズ", :ancestry=>"6"}, {:id=>84, :name=>"コミック/アニメグッズ", :ancestry=>"6"}, {:id=>85, :name=>"トレーディングカード", :ancestry=>"6"}, {:id=>86, :name=>"フィギュア", :ancestry=>"6"}, {:id=>87, :name=>"楽器/器材", :ancestry=>"6"}, {:id=>88, :name=>"コレクション", :ancestry=>"6"}, {:id=>89, :name=>"ミリタリー", :ancestry=>"6"}, {:id=>90, :name=>"美術品", :ancestry=>"6"}, {:id=>91, :name=>"アート用品", :ancestry=>"6"}, {:id=>92, :name=>"その他", :ancestry=>"6"}, {:id=>93, :name=>"ベースメイク", :ancestry=>"7"}, {:id=>94, :name=>"メイクアップ", :ancestry=>"7"}, {:id=>95, :name=>"ネイルケア", :ancestry=>"7"}, {:id=>96, :name=>"香水", :ancestry=>"7"}, {:id=>97, :name=>"スキンケア/基礎化粧品", :ancestry=>"7"}, {:id=>98, :name=>"ヘアケア", :ancestry=>"7"}, {:id=>99, :name=>"ボディケア", :ancestry=>"7"}, {:id=>100, :name=>"オーラルケア", :ancestry=>"7"} ) # BREAK EVAL Category.seed(:id, {:id=>101, :name=>"リラクゼーション", :ancestry=>"7"}, {:id=>102, :name=>"ダイエット", :ancestry=>"7"}, {:id=>103, :name=>"その他", :ancestry=>"7"}, {:id=>104, :name=>"スマートフォン/携帯電話", :ancestry=>"8"}, {:id=>105, :name=>"スマホアクセサリー", :ancestry=>"8"}, {:id=>106, :name=>"PC/タブレット", :ancestry=>"8"}, {:id=>107, :name=>"カメラ", :ancestry=>"8"}, {:id=>108, :name=>"テレビ/映像機器", :ancestry=>"8"}, {:id=>109, :name=>"オーディオ機器", :ancestry=>"8"}, {:id=>110, :name=>"美容/健康", :ancestry=>"8"}, {:id=>111, :name=>"冷暖房/空調", :ancestry=>"8"}, {:id=>112, :name=>"生活家電", :ancestry=>"8"}, {:id=>113, :name=>"その他", :ancestry=>"8"}, {:id=>114, :name=>"ゴルフ", :ancestry=>"9"}, {:id=>115, :name=>"フィッシング", :ancestry=>"9"}, {:id=>116, :name=>"自転車", :ancestry=>"9"}, {:id=>117, :name=>"トレーニング/エクササイズ", :ancestry=>"9"}, {:id=>118, :name=>"野球", :ancestry=>"9"}, {:id=>119, :name=>"サッカー/フットサル", :ancestry=>"9"}, {:id=>120, :name=>"テニス", :ancestry=>"9"}, {:id=>121, :name=>"スノーボード", :ancestry=>"9"}, {:id=>122, :name=>"スキー", :ancestry=>"9"}, {:id=>123, :name=>"その他スポーツ", :ancestry=>"9"}, {:id=>124, :name=>"アウトドア", :ancestry=>"9"}, {:id=>125, :name=>"その他", :ancestry=>"9"}, {:id=>126, :name=>"アクセサリー(女性用)", :ancestry=>"10"}, {:id=>127, :name=>"ファッション/小物", :ancestry=>"10"}, {:id=>128, :name=>"アクセサリー/時計", :ancestry=>"10"}, {:id=>129, :name=>"日用品/インテリア", :ancestry=>"10"}, {:id=>130, :name=>"趣味/おもちゃ", :ancestry=>"10"}, {:id=>131, :name=>"キッズ/ベビー", :ancestry=>"10"}, {:id=>132, :name=>"素材/材料", :ancestry=>"10"}, {:id=>133, :name=>"二次創作物", :ancestry=>"10"}, {:id=>134, :name=>"その他", :ancestry=>"10"}, {:id=>135, :name=>"音楽", :ancestry=>"11"}, {:id=>136, :name=>"スポーツ", :ancestry=>"11"}, {:id=>137, :name=>"演劇/芸能", :ancestry=>"11"}, {:id=>138, :name=>"イベント", :ancestry=>"11"}, {:id=>139, :name=>"映画", :ancestry=>"11"}, {:id=>140, :name=>"施設利用券", :ancestry=>"11"}, {:id=>141, :name=>"優待券/割引券", :ancestry=>"11"}, {:id=>142, :name=>"その他", :ancestry=>"11"}, {:id=>143, :name=>"自動車本体", :ancestry=>"12"}, {:id=>144, :name=>"自動車タイヤ/ホイール", :ancestry=>"12"}, {:id=>145, :name=>"自動車パーツ", :ancestry=>"12"}, {:id=>146, :name=>"自動車アクセサリー", :ancestry=>"12"}, {:id=>147, :name=>"オートバイ車体", :ancestry=>"12"}, {:id=>148, :name=>"オートバイパーツ", :ancestry=>"12"}, {:id=>149, :name=>"オートバイアクセサリー", :ancestry=>"12"}, {:id=>150, :name=>"まとめ売り", :ancestry=>"13"}, {:id=>151, :name=>"ペット用品", :ancestry=>"13"}, {:id=>152, :name=>"食品", :ancestry=>"13"}, {:id=>153, :name=>"飲料/酒", :ancestry=>"13"}, {:id=>154, :name=>"日用品/生活雑貨/旅行", :ancestry=>"13"}, {:id=>155, :name=>"アンティーク/コレクション", :ancestry=>"13"}, {:id=>156, :name=>"文房具/事務用品", :ancestry=>"13"}, {:id=>157, :name=>"事務/店舗用品", :ancestry=>"13"}, {:id=>158, :name=>"その他", :ancestry=>"13"}, {:id=>159, :name=>"Tシャツ/カットソー(半袖/袖なし)", :ancestry=>"1/14"}, {:id=>160, :name=>"Tシャツ/カットソー(七分/長袖)", :ancestry=>"1/14"}, {:id=>161, :name=>"シャツ/ブラウス(半袖/袖なし)", :ancestry=>"1/14"}, {:id=>162, :name=>"シャツ/ブラウス(七分/長袖)", :ancestry=>"1/14"}, {:id=>163, :name=>"ポロシャツ", :ancestry=>"1/14"}, {:id=>164, :name=>"キャミソール", :ancestry=>"1/14"}, {:id=>165, :name=>"タンクトップ", :ancestry=>"1/14"}, {:id=>166, :name=>"ホルターネック", :ancestry=>"1/14"}, {:id=>167, :name=>"ニット/セーター", :ancestry=>"1/14"}, {:id=>168, :name=>"チュニック", :ancestry=>"1/14"}, {:id=>169, :name=>"カーディガン/ボレロ", :ancestry=>"1/14"}, {:id=>170, :name=>"アンサンブル", :ancestry=>"1/14"}, {:id=>171, :name=>"ベスト/ジレ", :ancestry=>"1/14"}, {:id=>172, :name=>"パーカー", :ancestry=>"1/14"}, {:id=>173, :name=>"トレーナー/スウェット", :ancestry=>"1/14"}, {:id=>174, :name=>"ベアトップ/チューブトップ", :ancestry=>"1/14"}, {:id=>175, :name=>"ジャージ", :ancestry=>"1/14"}, {:id=>176, :name=>"その他", :ancestry=>"1/14"}, {:id=>177, :name=>"テーラードジャケット", :ancestry=>"1/15"}, {:id=>178, :name=>"ノーカラージャケット", :ancestry=>"1/15"}, {:id=>179, :name=>"Gジャン/デニムジャケット", :ancestry=>"1/15"}, {:id=>180, :name=>"レザージャケット", :ancestry=>"1/15"}, {:id=>181, :name=>"ダウンジャケット", :ancestry=>"1/15"}, {:id=>182, :name=>"ライダースジャケット", :ancestry=>"1/15"}, {:id=>183, :name=>"ミリタリージャケット", :ancestry=>"1/15"}, {:id=>184, :name=>"ダウンベスト", :ancestry=>"1/15"}, {:id=>185, :name=>"ジャンパー/ブルゾン", :ancestry=>"1/15"}, {:id=>186, :name=>"ポンチョ", :ancestry=>"1/15"}, {:id=>187, :name=>"ロングコート", :ancestry=>"1/15"}, {:id=>188, :name=>"トレンチコート", :ancestry=>"1/15"}, {:id=>189, :name=>"ダッフルコート", :ancestry=>"1/15"}, {:id=>190, :name=>"ピーコート", :ancestry=>"1/15"}, {:id=>191, :name=>"チェスターコート", :ancestry=>"1/15"}, {:id=>192, :name=>"モッズコート", :ancestry=>"1/15"}, {:id=>193, :name=>"スタジャン", :ancestry=>"1/15"}, {:id=>194, :name=>"毛皮/ファーコート", :ancestry=>"1/15"}, {:id=>195, :name=>"スプリングコート", :ancestry=>"1/15"}, {:id=>196, :name=>"スカジャン", :ancestry=>"1/15"}, {:id=>197, :name=>"その他", :ancestry=>"1/15"}, {:id=>198, :name=>"デニム/ジーンズ", :ancestry=>"1/16"}, {:id=>199, :name=>"ショートパンツ", :ancestry=>"1/16"}, {:id=>200, :name=>"カジュアルパンツ", :ancestry=>"1/16"} ) # BREAK EVAL Category.seed(:id, {:id=>201, :name=>"ハーフパンツ", :ancestry=>"1/16"}, {:id=>202, :name=>"チノパン", :ancestry=>"1/16"}, {:id=>203, :name=>"ワークパンツ/カーゴパンツ", :ancestry=>"1/16"}, {:id=>204, :name=>"クロップドパンツ", :ancestry=>"1/16"}, {:id=>205, :name=>"サロペット/オーバーオール", :ancestry=>"1/16"}, {:id=>206, :name=>"オールインワン", :ancestry=>"1/16"}, {:id=>207, :name=>"サルエルパンツ", :ancestry=>"1/16"}, {:id=>208, :name=>"ガウチョパンツ", :ancestry=>"1/16"}, {:id=>209, :name=>"その他", :ancestry=>"1/16"}, {:id=>210, :name=>"ミニスカート", :ancestry=>"1/17"}, {:id=>211, :name=>"ひざ丈スカート", :ancestry=>"1/17"}, {:id=>212, :name=>"ロングスカート", :ancestry=>"1/17"}, {:id=>213, :name=>"キュロット", :ancestry=>"1/17"}, {:id=>214, :name=>"その他", :ancestry=>"1/17"}, {:id=>215, :name=>"ミニワンピース", :ancestry=>"1/18"}, {:id=>216, :name=>"ひざ丈ワンピース", :ancestry=>"1/18"}, {:id=>217, :name=>"ロングワンピース", :ancestry=>"1/18"}, {:id=>218, :name=>"その他", :ancestry=>"1/18"}, {:id=>219, :name=>"ハイヒール/パンプス", :ancestry=>"1/19"}, {:id=>220, :name=>"ブーツ", :ancestry=>"1/19"}, {:id=>221, :name=>"サンダル", :ancestry=>"1/19"}, {:id=>222, :name=>"スニーカー", :ancestry=>"1/19"}, {:id=>223, :name=>"ミュール", :ancestry=>"1/19"}, {:id=>224, :name=>"モカシン", :ancestry=>"1/19"}, {:id=>225, :name=>"ローファー/革靴", :ancestry=>"1/19"}, {:id=>226, :name=>"フラットシューズ/バレエシューズ", :ancestry=>"1/19"}, {:id=>227, :name=>"長靴/レインシューズ", :ancestry=>"1/19"}, {:id=>228, :name=>"その他", :ancestry=>"1/19"}, {:id=>229, :name=>"パジャマ", :ancestry=>"1/20"}, {:id=>230, :name=>"ルームウェア", :ancestry=>"1/20"}, {:id=>231, :name=>"ソックス", :ancestry=>"1/21"}, {:id=>232, :name=>"スパッツ/レギンス", :ancestry=>"1/21"}, {:id=>233, :name=>"ストッキング/タイツ", :ancestry=>"1/21"}, {:id=>234, :name=>"レッグウォーマー", :ancestry=>"1/21"}, {:id=>235, :name=>"その他", :ancestry=>"1/21"}, {:id=>236, :name=>"ニットキャップ/ビーニー", :ancestry=>"1/22"}, {:id=>237, :name=>"ハット", :ancestry=>"1/22"}, {:id=>238, :name=>"ハンチング/ベレー帽", :ancestry=>"1/22"}, {:id=>239, :name=>"キャップ", :ancestry=>"1/22"}, {:id=>240, :name=>"キャスケット", :ancestry=>"1/22"}, {:id=>241, :name=>"麦わら帽子", :ancestry=>"1/22"}, {:id=>242, :name=>"その他", :ancestry=>"1/22"}, {:id=>243, :name=>"ハンドバッグ", :ancestry=>"1/23"}, {:id=>244, :name=>"トートバッグ", :ancestry=>"1/23"}, {:id=>245, :name=>"エコバッグ", :ancestry=>"1/23"}, {:id=>246, :name=>"リュック/バックパック", :ancestry=>"1/23"}, {:id=>247, :name=>"ボストンバッグ", :ancestry=>"1/23"}, {:id=>248, :name=>"スポーツバッグ", :ancestry=>"1/23"}, {:id=>249, :name=>"ショルダーバッグ", :ancestry=>"1/23"}, {:id=>250, :name=>"クラッチバッグ", :ancestry=>"1/23"}, {:id=>251, :name=>"ポーチ/バニティ", :ancestry=>"1/23"}, {:id=>252, :name=>"ボディバッグ/ウェストバッグ", :ancestry=>"1/23"}, {:id=>253, :name=>"マザーズバッグ", :ancestry=>"1/23"}, {:id=>254, :name=>"メッセンジャーバッグ", :ancestry=>"1/23"}, {:id=>255, :name=>"ビジネスバッグ", :ancestry=>"1/23"}, {:id=>256, :name=>"旅行用バッグ/キャリーバッグ", :ancestry=>"1/23"}, {:id=>257, :name=>"ショップ袋", :ancestry=>"1/23"}, {:id=>258, :name=>"和装用バッグ", :ancestry=>"1/23"}, {:id=>259, :name=>"かごバッグ", :ancestry=>"1/23"}, {:id=>260, :name=>"その他", :ancestry=>"1/23"}, {:id=>261, :name=>"ネックレス", :ancestry=>"1/24"}, {:id=>262, :name=>"ブレスレット", :ancestry=>"1/24"}, {:id=>263, :name=>"バングル/リストバンド", :ancestry=>"1/24"}, {:id=>264, :name=>"リング", :ancestry=>"1/24"}, {:id=>265, :name=>"ピアス(片耳用)", :ancestry=>"1/24"}, {:id=>266, :name=>"ピアス(両耳用)", :ancestry=>"1/24"}, {:id=>267, :name=>"イヤリング", :ancestry=>"1/24"}, {:id=>268, :name=>"アンクレット", :ancestry=>"1/24"}, {:id=>269, :name=>"ブローチ/コサージュ", :ancestry=>"1/24"}, {:id=>270, :name=>"チャーム", :ancestry=>"1/24"}, {:id=>271, :name=>"その他", :ancestry=>"1/24"}, {:id=>272, :name=>"ヘアゴム/シュシュ", :ancestry=>"1/25"}, {:id=>273, :name=>"ヘアバンド/カチューシャ", :ancestry=>"1/25"}, {:id=>274, :name=>"ヘアピン", :ancestry=>"1/25"}, {:id=>275, :name=>"その他", :ancestry=>"1/25"}, {:id=>276, :name=>"長財布", :ancestry=>"1/26"}, {:id=>277, :name=>"折り財布", :ancestry=>"1/26"}, {:id=>278, :name=>"コインケース/小銭入れ", :ancestry=>"1/26"}, {:id=>279, :name=>"名刺入れ/定期入れ", :ancestry=>"1/26"}, {:id=>280, :name=>"キーケース", :ancestry=>"1/26"}, {:id=>281, :name=>"キーホルダー", :ancestry=>"1/26"}, {:id=>282, :name=>"手袋/アームカバー", :ancestry=>"1/26"}, {:id=>283, :name=>"ハンカチ", :ancestry=>"1/26"}, {:id=>284, :name=>"ベルト", :ancestry=>"1/26"}, {:id=>285, :name=>"マフラー/ショール", :ancestry=>"1/26"}, {:id=>286, :name=>"ストール/スヌード", :ancestry=>"1/26"}, {:id=>287, :name=>"バンダナ/スカーフ", :ancestry=>"1/26"}, {:id=>288, :name=>"ネックウォーマー", :ancestry=>"1/26"}, {:id=>289, :name=>"サスペンダー", :ancestry=>"1/26"}, {:id=>290, :name=>"サングラス/メガネ", :ancestry=>"1/26"}, {:id=>291, :name=>"モバイルケース/カバー", :ancestry=>"1/26"}, {:id=>292, :name=>"手帳", :ancestry=>"1/26"}, {:id=>293, :name=>"イヤマフラー", :ancestry=>"1/26"}, {:id=>294, :name=>"傘", :ancestry=>"1/26"}, {:id=>295, :name=>"レインコート/ポンチョ", :ancestry=>"1/26"}, {:id=>296, :name=>"ミラー", :ancestry=>"1/26"}, {:id=>297, :name=>"タバコグッズ", :ancestry=>"1/26"}, {:id=>298, :name=>"その他", :ancestry=>"1/26"}, {:id=>299, :name=>"腕時計(アナログ)", :ancestry=>"1/27"}, {:id=>300, :name=>"腕時計(デジタル)", :ancestry=>"1/27"} ) # BREAK EVAL Category.seed(:id, {:id=>301, :name=>"ラバーベルト", :ancestry=>"1/27"}, {:id=>302, :name=>"レザーベルト", :ancestry=>"1/27"}, {:id=>303, :name=>"金属ベルト", :ancestry=>"1/27"}, {:id=>304, :name=>"その他", :ancestry=>"1/27"}, {:id=>305, :name=>"前髪ウィッグ", :ancestry=>"1/28"}, {:id=>306, :name=>"ロングストレート", :ancestry=>"1/28"}, {:id=>307, :name=>"ロングカール", :ancestry=>"1/28"}, {:id=>308, :name=>"ショートストレート", :ancestry=>"1/28"}, {:id=>309, :name=>"ショートカール", :ancestry=>"1/28"}, {:id=>310, :name=>"その他", :ancestry=>"1/28"}, {:id=>311, :name=>"浴衣", :ancestry=>"1/29"}, {:id=>312, :name=>"着物", :ancestry=>"1/29"}, {:id=>313, :name=>"振袖", :ancestry=>"1/29"}, {:id=>314, :name=>"長襦袢/半襦袢", :ancestry=>"1/29"}, {:id=>315, :name=>"水着セパレート", :ancestry=>"1/29"}, {:id=>316, :name=>"水着ワンピース", :ancestry=>"1/29"}, {:id=>317, :name=>"水着スポーツ用", :ancestry=>"1/29"}, {:id=>318, :name=>"その他", :ancestry=>"1/29"}, {:id=>319, :name=>"スカートスーツ上下", :ancestry=>"1/30"}, {:id=>320, :name=>"パンツスーツ上下", :ancestry=>"1/30"}, {:id=>321, :name=>"ドレス", :ancestry=>"1/30"}, {:id=>322, :name=>"パーティーバッグ", :ancestry=>"1/30"}, {:id=>323, :name=>"シューズ", :ancestry=>"1/30"}, {:id=>324, :name=>"ウェディング", :ancestry=>"1/30"}, {:id=>325, :name=>"その他", :ancestry=>"1/30"}, {:id=>326, :name=>"トップス", :ancestry=>"1/31"}, {:id=>327, :name=>"アウター", :ancestry=>"1/31"}, {:id=>328, :name=>"インナー", :ancestry=>"1/31"}, {:id=>329, :name=>"ワンピース", :ancestry=>"1/31"}, {:id=>330, :name=>"パンツ/スパッツ", :ancestry=>"1/31"}, {:id=>331, :name=>"スカート", :ancestry=>"1/31"}, {:id=>332, :name=>"パジャマ", :ancestry=>"1/31"}, {:id=>333, :name=>"授乳服", :ancestry=>"1/31"}, {:id=>334, :name=>"その他", :ancestry=>"1/31"}, {:id=>335, :name=>"コスプレ", :ancestry=>"1/32"}, {:id=>336, :name=>"下着", :ancestry=>"1/32"}, {:id=>337, :name=>"その他", :ancestry=>"1/32"}, {:id=>338, :name=>"Tシャツ/カットソー(半袖/袖なし)", :ancestry=>"2/33"}, {:id=>339, :name=>"Tシャツ/カットソー(七分/長袖)", :ancestry=>"2/33"}, {:id=>340, :name=>"シャツ", :ancestry=>"2/33"}, {:id=>341, :name=>"ポロシャツ", :ancestry=>"2/33"}, {:id=>342, :name=>"タンクトップ", :ancestry=>"2/33"}, {:id=>343, :name=>"ニット/セーター", :ancestry=>"2/33"}, {:id=>344, :name=>"パーカー", :ancestry=>"2/33"}, {:id=>345, :name=>"カーディガン", :ancestry=>"2/33"}, {:id=>346, :name=>"スウェット", :ancestry=>"2/33"}, {:id=>347, :name=>"ジャージ", :ancestry=>"2/33"}, {:id=>348, :name=>"ベスト", :ancestry=>"2/33"}, {:id=>349, :name=>"その他", :ancestry=>"2/33"}, {:id=>350, :name=>"テーラードジャケット", :ancestry=>"2/34"}, {:id=>351, :name=>"ノーカラージャケット", :ancestry=>"2/34"}, {:id=>352, :name=>"Gジャン/デニムジャケット", :ancestry=>"2/34"}, {:id=>353, :name=>"レザージャケット", :ancestry=>"2/34"}, {:id=>354, :name=>"ダウンジャケット", :ancestry=>"2/34"}, {:id=>355, :name=>"ライダースジャケット", :ancestry=>"2/34"}, {:id=>356, :name=>"ミリタリージャケット", :ancestry=>"2/34"}, {:id=>357, :name=>"ナイロンジャケット", :ancestry=>"2/34"}, {:id=>358, :name=>"フライトジャケット", :ancestry=>"2/34"}, {:id=>359, :name=>"ダッフルコート", :ancestry=>"2/34"}, {:id=>360, :name=>"ピーコート", :ancestry=>"2/34"}, {:id=>361, :name=>"ステンカラーコート", :ancestry=>"2/34"}, {:id=>362, :name=>"トレンチコート", :ancestry=>"2/34"}, {:id=>363, :name=>"モッズコート", :ancestry=>"2/34"}, {:id=>364, :name=>"チェスターコート", :ancestry=>"2/34"}, {:id=>365, :name=>"スタジャン", :ancestry=>"2/34"}, {:id=>366, :name=>"スカジャン", :ancestry=>"2/34"}, {:id=>367, :name=>"ブルゾン", :ancestry=>"2/34"}, {:id=>368, :name=>"マウンテンパーカー", :ancestry=>"2/34"}, {:id=>369, :name=>"ダウンベスト", :ancestry=>"2/34"}, {:id=>370, :name=>"ポンチョ", :ancestry=>"2/34"}, {:id=>371, :name=>"カバーオール", :ancestry=>"2/34"}, {:id=>372, :name=>"その他", :ancestry=>"2/34"}, {:id=>373, :name=>"デニム/ジーンズ", :ancestry=>"2/35"}, {:id=>374, :name=>"ワークパンツ/カーゴパンツ", :ancestry=>"2/35"}, {:id=>375, :name=>"スラックス", :ancestry=>"2/35"}, {:id=>376, :name=>"チノパン", :ancestry=>"2/35"}, {:id=>377, :name=>"ショートパンツ", :ancestry=>"2/35"}, {:id=>378, :name=>"ペインターパンツ", :ancestry=>"2/35"}, {:id=>379, :name=>"サルエルパンツ", :ancestry=>"2/35"}, {:id=>380, :name=>"オーバーオール", :ancestry=>"2/35"}, {:id=>381, :name=>"その他", :ancestry=>"2/35"}, {:id=>382, :name=>"スニーカー", :ancestry=>"2/36"}, {:id=>383, :name=>"サンダル", :ancestry=>"2/36"}, {:id=>384, :name=>"ブーツ", :ancestry=>"2/36"}, {:id=>385, :name=>"モカシン", :ancestry=>"2/36"}, {:id=>386, :name=>"ドレス/ビジネス", :ancestry=>"2/36"}, {:id=>387, :name=>"長靴/レインシューズ", :ancestry=>"2/36"}, {:id=>388, :name=>"デッキシューズ", :ancestry=>"2/36"}, {:id=>389, :name=>"その他", :ancestry=>"2/36"}, {:id=>390, :name=>"ショルダーバッグ", :ancestry=>"2/37"}, {:id=>391, :name=>"トートバッグ", :ancestry=>"2/37"}, {:id=>392, :name=>"ボストンバッグ", :ancestry=>"2/37"}, {:id=>393, :name=>"リュック/バックパック", :ancestry=>"2/37"}, {:id=>394, :name=>"ウエストポーチ", :ancestry=>"2/37"}, {:id=>395, :name=>"ボディーバッグ", :ancestry=>"2/37"}, {:id=>396, :name=>"ドラムバッグ", :ancestry=>"2/37"}, {:id=>397, :name=>"ビジネスバッグ", :ancestry=>"2/37"}, {:id=>398, :name=>"トラベルバッグ", :ancestry=>"2/37"}, {:id=>399, :name=>"メッセンジャーバッグ", :ancestry=>"2/37"}, {:id=>400, :name=>"エコバッグ", :ancestry=>"2/37"} ) # BREAK EVAL Category.seed(:id, {:id=>401, :name=>"その他", :ancestry=>"2/37"}, {:id=>402, :name=>"スーツジャケット", :ancestry=>"2/38"}, {:id=>403, :name=>"スーツベスト", :ancestry=>"2/38"}, {:id=>404, :name=>"スラックス", :ancestry=>"2/38"}, {:id=>405, :name=>"セットアップ", :ancestry=>"2/38"}, {:id=>406, :name=>"その他", :ancestry=>"2/38"}, {:id=>407, :name=>"キャップ", :ancestry=>"2/39"}, {:id=>408, :name=>"ハット", :ancestry=>"2/39"}, {:id=>409, :name=>"ニットキャップ/ビーニー", :ancestry=>"2/39"}, {:id=>410, :name=>"ハンチング/ベレー帽", :ancestry=>"2/39"}, {:id=>411, :name=>"キャスケット", :ancestry=>"2/39"}, {:id=>412, :name=>"サンバイザー", :ancestry=>"2/39"}, {:id=>413, :name=>"その他", :ancestry=>"2/39"}, {:id=>414, :name=>"ネックレス", :ancestry=>"2/40"}, {:id=>415, :name=>"ブレスレット", :ancestry=>"2/40"}, {:id=>416, :name=>"バングル/リストバンド", :ancestry=>"2/40"}, {:id=>417, :name=>"リング", :ancestry=>"2/40"}, {:id=>418, :name=>"ピアス(片耳用)", :ancestry=>"2/40"}, {:id=>419, :name=>"ピアス(両耳用)", :ancestry=>"2/40"}, {:id=>420, :name=>"アンクレット", :ancestry=>"2/40"}, {:id=>421, :name=>"その他", :ancestry=>"2/40"}, {:id=>422, :name=>"長財布", :ancestry=>"2/41"}, {:id=>423, :name=>"折り財布", :ancestry=>"2/41"}, {:id=>424, :name=>"マネークリップ", :ancestry=>"2/41"}, {:id=>425, :name=>"コインケース/小銭入れ", :ancestry=>"2/41"}, {:id=>426, :name=>"名刺入れ/定期入れ", :ancestry=>"2/41"}, {:id=>427, :name=>"キーケース", :ancestry=>"2/41"}, {:id=>428, :name=>"キーホルダー", :ancestry=>"2/41"}, {:id=>429, :name=>"ネクタイ", :ancestry=>"2/41"}, {:id=>430, :name=>"手袋", :ancestry=>"2/41"}, {:id=>431, :name=>"ハンカチ", :ancestry=>"2/41"}, {:id=>432, :name=>"ベルト", :ancestry=>"2/41"}, {:id=>433, :name=>"マフラー", :ancestry=>"2/41"}, {:id=>434, :name=>"ストール", :ancestry=>"2/41"}, {:id=>435, :name=>"バンダナ", :ancestry=>"2/41"}, {:id=>436, :name=>"ネックウォーマー", :ancestry=>"2/41"}, {:id=>437, :name=>"サスペンダー", :ancestry=>"2/41"}, {:id=>438, :name=>"ウォレットチェーン", :ancestry=>"2/41"}, {:id=>439, :name=>"サングラス/メガネ", :ancestry=>"2/41"}, {:id=>440, :name=>"モバイルケース/カバー", :ancestry=>"2/41"}, {:id=>441, :name=>"手帳", :ancestry=>"2/41"}, {:id=>442, :name=>"ストラップ", :ancestry=>"2/41"}, {:id=>443, :name=>"ネクタイピン", :ancestry=>"2/41"}, {:id=>444, :name=>"カフリンクス", :ancestry=>"2/41"}, {:id=>445, :name=>"イヤマフラー", :ancestry=>"2/41"}, {:id=>446, :name=>"傘", :ancestry=>"2/41"}, {:id=>447, :name=>"レインコート", :ancestry=>"2/41"}, {:id=>448, :name=>"ミラー", :ancestry=>"2/41"}, {:id=>449, :name=>"タバコグッズ", :ancestry=>"2/41"}, {:id=>450, :name=>"その他", :ancestry=>"2/41"}, {:id=>451, :name=>"腕時計(アナログ)", :ancestry=>"2/42"}, {:id=>452, :name=>"腕時計(デジタル)", :ancestry=>"2/42"}, {:id=>453, :name=>"ラバーベルト", :ancestry=>"2/42"}, {:id=>454, :name=>"レザーベルト", :ancestry=>"2/42"}, {:id=>455, :name=>"金属ベルト", :ancestry=>"2/42"}, {:id=>456, :name=>"その他", :ancestry=>"2/42"}, {:id=>457, :name=>"一般水着", :ancestry=>"2/43"}, {:id=>458, :name=>"スポーツ用", :ancestry=>"2/43"}, {:id=>459, :name=>"アクセサリー", :ancestry=>"2/43"}, {:id=>460, :name=>"その他", :ancestry=>"2/43"}, {:id=>461, :name=>"ソックス", :ancestry=>"2/44"}, {:id=>462, :name=>"レギンス/スパッツ", :ancestry=>"2/44"}, {:id=>463, :name=>"レッグウォーマー", :ancestry=>"2/44"}, {:id=>464, :name=>"その他", :ancestry=>"2/44"}, {:id=>465, :name=>"トランクス", :ancestry=>"2/45"}, {:id=>466, :name=>"ボクサーパンツ", :ancestry=>"2/45"}, {:id=>467, :name=>"その他", :ancestry=>"2/45"}, {:id=>468, :name=>"トップス", :ancestry=>"3/47"}, {:id=>469, :name=>"アウター", :ancestry=>"3/47"}, {:id=>470, :name=>"パンツ", :ancestry=>"3/47"}, {:id=>471, :name=>"スカート", :ancestry=>"3/47"}, {:id=>472, :name=>"ワンピース", :ancestry=>"3/47"}, {:id=>473, :name=>"ベビードレス", :ancestry=>"3/47"}, {:id=>474, :name=>"おくるみ", :ancestry=>"3/47"}, {:id=>475, :name=>"下着/肌着", :ancestry=>"3/47"}, {:id=>476, :name=>"パジャマ", :ancestry=>"3/47"}, {:id=>477, :name=>"ロンパース", :ancestry=>"3/47"}, {:id=>478, :name=>"その他", :ancestry=>"3/47"}, {:id=>479, :name=>"トップス", :ancestry=>"3/48"}, {:id=>480, :name=>"アウター", :ancestry=>"3/48"}, {:id=>481, :name=>"パンツ", :ancestry=>"3/48"}, {:id=>482, :name=>"おくるみ", :ancestry=>"3/48"}, {:id=>483, :name=>"下着/肌着", :ancestry=>"3/48"}, {:id=>484, :name=>"パジャマ", :ancestry=>"3/48"}, {:id=>485, :name=>"ロンパース", :ancestry=>"3/48"}, {:id=>486, :name=>"その他", :ancestry=>"3/48"}, {:id=>487, :name=>"トップス", :ancestry=>"3/49"}, {:id=>488, :name=>"アウター", :ancestry=>"3/49"}, {:id=>489, :name=>"パンツ", :ancestry=>"3/49"}, {:id=>490, :name=>"おくるみ", :ancestry=>"3/49"}, {:id=>491, :name=>"下着/肌着", :ancestry=>"3/49"}, {:id=>492, :name=>"パジャマ", :ancestry=>"3/49"}, {:id=>493, :name=>"ロンパース", :ancestry=>"3/49"}, {:id=>494, :name=>"その他", :ancestry=>"3/49"}, {:id=>495, :name=>"コート", :ancestry=>"3/50"}, {:id=>496, :name=>"ジャケット/上着", :ancestry=>"3/50"}, {:id=>497, :name=>"トップス(Tシャツ/カットソー)", :ancestry=>"3/50"}, {:id=>498, :name=>"トップス(トレーナー)", :ancestry=>"3/50"}, {:id=>499, :name=>"トップス(チュニック)", :ancestry=>"3/50"}, {:id=>500, :name=>"トップス(タンクトップ)", :ancestry=>"3/50"} ) # BREAK EVAL Category.seed(:id, {:id=>501, :name=>"トップス(その他)", :ancestry=>"3/50"}, {:id=>502, :name=>"スカート", :ancestry=>"3/50"}, {:id=>503, :name=>"パンツ", :ancestry=>"3/50"}, {:id=>504, :name=>"ワンピース", :ancestry=>"3/50"}, {:id=>505, :name=>"セットアップ", :ancestry=>"3/50"}, {:id=>506, :name=>"パジャマ", :ancestry=>"3/50"}, {:id=>507, :name=>"フォーマル/ドレス", :ancestry=>"3/50"}, {:id=>508, :name=>"和服", :ancestry=>"3/50"}, {:id=>509, :name=>"浴衣", :ancestry=>"3/50"}, {:id=>510, :name=>"甚平", :ancestry=>"3/50"}, {:id=>511, :name=>"水着", :ancestry=>"3/50"}, {:id=>512, :name=>"その他", :ancestry=>"3/50"}, {:id=>513, :name=>"コート", :ancestry=>"3/51"}, {:id=>514, :name=>"ジャケット/上着", :ancestry=>"3/51"}, {:id=>515, :name=>"トップス(Tシャツ/カットソー)", :ancestry=>"3/51"}, {:id=>516, :name=>"トップス(トレーナー)", :ancestry=>"3/51"}, {:id=>517, :name=>"トップス(その他)", :ancestry=>"3/51"}, {:id=>518, :name=>"パンツ", :ancestry=>"3/51"}, {:id=>519, :name=>"セットアップ", :ancestry=>"3/51"}, {:id=>520, :name=>"パジャマ", :ancestry=>"3/51"}, {:id=>521, :name=>"フォーマル/ドレス", :ancestry=>"3/51"}, {:id=>522, :name=>"和服", :ancestry=>"3/51"}, {:id=>523, :name=>"浴衣", :ancestry=>"3/51"}, {:id=>524, :name=>"甚平", :ancestry=>"3/51"}, {:id=>525, :name=>"水着", :ancestry=>"3/51"}, {:id=>526, :name=>"その他", :ancestry=>"3/51"}, {:id=>527, :name=>"コート", :ancestry=>"3/52"}, {:id=>528, :name=>"ジャケット/上着", :ancestry=>"3/52"}, {:id=>529, :name=>"トップス(Tシャツ/カットソー)", :ancestry=>"3/52"}, {:id=>530, :name=>"トップス(トレーナー)", :ancestry=>"3/52"}, {:id=>531, :name=>"トップス(その他)", :ancestry=>"3/52"}, {:id=>532, :name=>"ボトムス", :ancestry=>"3/52"}, {:id=>533, :name=>"パジャマ", :ancestry=>"3/52"}, {:id=>534, :name=>"その他", :ancestry=>"3/52"}, {:id=>535, :name=>"スニーカー", :ancestry=>"3/53"}, {:id=>536, :name=>"サンダル", :ancestry=>"3/53"}, {:id=>537, :name=>"ブーツ", :ancestry=>"3/53"}, {:id=>538, :name=>"長靴", :ancestry=>"3/53"}, {:id=>539, :name=>"その他", :ancestry=>"3/53"}, {:id=>540, :name=>"靴下/スパッツ", :ancestry=>"3/54"}, {:id=>541, :name=>"帽子", :ancestry=>"3/54"}, {:id=>542, :name=>"エプロン", :ancestry=>"3/54"}, {:id=>543, :name=>"サスペンダー", :ancestry=>"3/54"}, {:id=>544, :name=>"タイツ", :ancestry=>"3/54"}, {:id=>545, :name=>"ハンカチ", :ancestry=>"3/54"}, {:id=>546, :name=>"バンダナ", :ancestry=>"3/54"}, {:id=>547, :name=>"ベルト", :ancestry=>"3/54"}, {:id=>548, :name=>"マフラー", :ancestry=>"3/54"}, {:id=>549, :name=>"傘", :ancestry=>"3/54"}, {:id=>550, :name=>"手袋", :ancestry=>"3/54"}, {:id=>551, :name=>"スタイ", :ancestry=>"3/54"}, {:id=>552, :name=>"バッグ", :ancestry=>"3/54"}, {:id=>553, :name=>"その他", :ancestry=>"3/54"}, {:id=>554, :name=>"おむつ用品", :ancestry=>"3/55"}, {:id=>555, :name=>"おまる/補助便座", :ancestry=>"3/55"}, {:id=>556, :name=>"トレーニングパンツ", :ancestry=>"3/55"}, {:id=>557, :name=>"ベビーバス", :ancestry=>"3/55"}, {:id=>558, :name=>"お風呂用品", :ancestry=>"3/55"}, {:id=>559, :name=>"その他", :ancestry=>"3/55"}, {:id=>560, :name=>"ベビーカー", :ancestry=>"3/56"}, {:id=>561, :name=>"抱っこひも/スリング", :ancestry=>"3/56"}, {:id=>562, :name=>"チャイルドシート", :ancestry=>"3/56"}, {:id=>563, :name=>"その他", :ancestry=>"3/56"}, {:id=>564, :name=>"ミルク", :ancestry=>"3/57"}, {:id=>565, :name=>"ベビーフード", :ancestry=>"3/57"}, {:id=>566, :name=>"ベビー用食器", :ancestry=>"3/57"}, {:id=>567, :name=>"その他", :ancestry=>"3/57"}, {:id=>568, :name=>"ベッド", :ancestry=>"3/58"}, {:id=>569, :name=>"布団/毛布", :ancestry=>"3/58"}, {:id=>570, :name=>"イス", :ancestry=>"3/58"}, {:id=>571, :name=>"たんす", :ancestry=>"3/58"}, {:id=>572, :name=>"その他", :ancestry=>"3/58"}, {:id=>573, :name=>"おふろのおもちゃ", :ancestry=>"3/59"}, {:id=>574, :name=>"がらがら", :ancestry=>"3/59"}, {:id=>575, :name=>"オルゴール", :ancestry=>"3/59"}, {:id=>576, :name=>"ベビージム", :ancestry=>"3/59"}, {:id=>577, :name=>"手押し車/カタカタ", :ancestry=>"3/59"}, {:id=>578, :name=>"知育玩具", :ancestry=>"3/59"}, {:id=>579, :name=>"その他", :ancestry=>"3/59"}, {:id=>580, :name=>"お宮参り用品", :ancestry=>"3/60"}, {:id=>581, :name=>"お食い初め用品", :ancestry=>"3/60"}, {:id=>582, :name=>"アルバム", :ancestry=>"3/60"}, {:id=>583, :name=>"手形/足形", :ancestry=>"3/60"}, {:id=>584, :name=>"その他", :ancestry=>"3/60"}, {:id=>585, :name=>"母子手帳用品", :ancestry=>"3/61"}, {:id=>586, :name=>"その他", :ancestry=>"3/61"}, {:id=>587, :name=>"食器", :ancestry=>"4/62"}, {:id=>588, :name=>"調理器具", :ancestry=>"4/62"}, {:id=>589, :name=>"収納/キッチン雑貨", :ancestry=>"4/62"}, {:id=>590, :name=>"弁当用品", :ancestry=>"4/62"}, {:id=>591, :name=>"カトラリー(スプーン等)", :ancestry=>"4/62"}, {:id=>592, :name=>"テーブル用品", :ancestry=>"4/62"}, {:id=>593, :name=>"容器", :ancestry=>"4/62"}, {:id=>594, :name=>"エプロン", :ancestry=>"4/62"}, {:id=>595, :name=>"アルコールグッズ", :ancestry=>"4/62"}, {:id=>596, :name=>"浄水機", :ancestry=>"4/62"}, {:id=>597, :name=>"その他", :ancestry=>"4/62"}, {:id=>598, :name=>"セミシングルベッド", :ancestry=>"4/62"}, {:id=>599, :name=>"シングルベッド", :ancestry=>"4/62"}, {:id=>600, :name=>"セミダブルベッド", :ancestry=>"4/62"} ) # BREAK EVAL Category.seed(:id, {:id=>601, :name=>"ダブルベッド", :ancestry=>"4/62"}, {:id=>602, :name=>"ワイドダブルベッド", :ancestry=>"4/62"}, {:id=>603, :name=>"クイーンベッド", :ancestry=>"4/62"}, {:id=>604, :name=>"キングベッド", :ancestry=>"4/62"}, {:id=>605, :name=>"脚付きマットレスベッド", :ancestry=>"4/62"}, {:id=>606, :name=>"マットレス", :ancestry=>"4/62"}, {:id=>607, :name=>"すのこベッド", :ancestry=>"4/62"}, {:id=>608, :name=>"ロフトベッド/システムベッド", :ancestry=>"4/62"}, {:id=>609, :name=>"簡易ベッド/折りたたみベッド", :ancestry=>"4/62"}, {:id=>610, :name=>"収納付き", :ancestry=>"4/62"}, {:id=>611, :name=>"その他", :ancestry=>"4/62"}, {:id=>612, :name=>"ソファセット", :ancestry=>"4/62"}, {:id=>613, :name=>"シングルソファ", :ancestry=>"4/62"}, {:id=>614, :name=>"ラブソファ", :ancestry=>"4/62"}, {:id=>615, :name=>"トリプルソファ", :ancestry=>"4/62"}, {:id=>616, :name=>"オットマン", :ancestry=>"4/62"}, {:id=>617, :name=>"コーナーソファ", :ancestry=>"4/62"}, {:id=>618, :name=>"ビーズソファ/クッションソファ", :ancestry=>"4/62"}, {:id=>619, :name=>"ローソファ/フロアソファ", :ancestry=>"4/62"}, {:id=>620, :name=>"ソファベッド", :ancestry=>"4/62"}, {:id=>621, :name=>"応接セット", :ancestry=>"4/62"}, {:id=>622, :name=>"ソファカバー", :ancestry=>"4/62"}, {:id=>623, :name=>"リクライニングソファ", :ancestry=>"4/62"}, {:id=>624, :name=>"その他", :ancestry=>"4/62"}, {:id=>625, :name=>"一般", :ancestry=>"4/62"}, {:id=>626, :name=>"スツール", :ancestry=>"4/62"}, {:id=>627, :name=>"ダイニングチェア", :ancestry=>"4/62"}, {:id=>628, :name=>"ハイバックチェア", :ancestry=>"4/62"}, {:id=>629, :name=>"ロッキングチェア", :ancestry=>"4/62"}, {:id=>630, :name=>"座椅子", :ancestry=>"4/62"}, {:id=>631, :name=>"折り畳みイス", :ancestry=>"4/62"}, {:id=>632, :name=>"デスクチェア", :ancestry=>"4/62"}, {:id=>633, :name=>"その他", :ancestry=>"4/62"}, {:id=>634, :name=>"こたつ", :ancestry=>"4/62"}, {:id=>635, :name=>"カウンターテーブル", :ancestry=>"4/62"}, {:id=>636, :name=>"サイドテーブル", :ancestry=>"4/62"}, {:id=>637, :name=>"センターテーブル", :ancestry=>"4/62"}, {:id=>638, :name=>"ダイニングテーブル", :ancestry=>"4/62"}, {:id=>639, :name=>"座卓/ちゃぶ台", :ancestry=>"4/62"}, {:id=>640, :name=>"アウトドア用", :ancestry=>"4/62"}, {:id=>641, :name=>"パソコン用", :ancestry=>"4/62"}, {:id=>642, :name=>"事務机/学習机", :ancestry=>"4/62"}, {:id=>643, :name=>"その他", :ancestry=>"4/62"}, {:id=>644, :name=>"リビング収納", :ancestry=>"4/62"}, {:id=>645, :name=>"キッチン収納", :ancestry=>"4/62"}, {:id=>646, :name=>"玄関/屋外収納", :ancestry=>"4/62"}, {:id=>647, :name=>"バス/トイレ収納", :ancestry=>"4/62"}, {:id=>648, :name=>"本収納", :ancestry=>"4/62"}, {:id=>649, :name=>"本/CD/DVD収納", :ancestry=>"4/62"}, {:id=>650, :name=>"洋服タンス/押入れ収納", :ancestry=>"4/62"}, {:id=>651, :name=>"電話台/ファックス台", :ancestry=>"4/62"}, {:id=>652, :name=>"ドレッサー/鏡台", :ancestry=>"4/62"}, {:id=>653, :name=>"棚/ラック", :ancestry=>"4/62"}, {:id=>654, :name=>"ケース/ボックス", :ancestry=>"4/62"}, {:id=>655, :name=>"その他", :ancestry=>"4/62"}, {:id=>656, :name=>"ラグ", :ancestry=>"4/62"}, {:id=>657, :name=>"カーペット", :ancestry=>"4/62"}, {:id=>658, :name=>"ホットカーペット", :ancestry=>"4/62"}, {:id=>659, :name=>"玄関/キッチンマット", :ancestry=>"4/62"}, {:id=>660, :name=>"トイレ/バスマット", :ancestry=>"4/62"}, {:id=>661, :name=>"その他", :ancestry=>"4/62"}, {:id=>662, :name=>"カーテン", :ancestry=>"4/62"}, {:id=>663, :name=>"ブラインド", :ancestry=>"4/62"}, {:id=>664, :name=>"ロールスクリーン", :ancestry=>"4/62"}, {:id=>665, :name=>"のれん", :ancestry=>"4/62"}, {:id=>666, :name=>"その他", :ancestry=>"4/62"}, {:id=>667, :name=>"蛍光灯/電球", :ancestry=>"4/62"}, {:id=>668, :name=>"天井照明", :ancestry=>"4/62"}, {:id=>669, :name=>"フロアスタンド", :ancestry=>"4/62"}, {:id=>670, :name=>"その他", :ancestry=>"4/62"}, {:id=>671, :name=>"布団/毛布", :ancestry=>"4/62"}, {:id=>672, :name=>"枕", :ancestry=>"4/62"}, {:id=>673, :name=>"シーツ/カバー", :ancestry=>"4/62"}, {:id=>674, :name=>"その他", :ancestry=>"4/62"}, {:id=>675, :name=>"ごみ箱", :ancestry=>"4/62"}, {:id=>676, :name=>"ウェルカムボード", :ancestry=>"4/62"}, {:id=>677, :name=>"オルゴール", :ancestry=>"4/62"}, {:id=>678, :name=>"クッション", :ancestry=>"4/62"}, {:id=>679, :name=>"クッションカバー", :ancestry=>"4/62"}, {:id=>680, :name=>"スリッパラック", :ancestry=>"4/62"}, {:id=>681, :name=>"ティッシュボックス", :ancestry=>"4/62"}, {:id=>682, :name=>"バスケット/かご", :ancestry=>"4/62"}, {:id=>683, :name=>"フォトフレーム", :ancestry=>"4/62"}, {:id=>684, :name=>"マガジンラック", :ancestry=>"4/62"}, {:id=>685, :name=>"モビール", :ancestry=>"4/62"}, {:id=>686, :name=>"花瓶", :ancestry=>"4/62"}, {:id=>687, :name=>"灰皿", :ancestry=>"4/62"}, {:id=>688, :name=>"傘立て", :ancestry=>"4/62"}, {:id=>689, :name=>"小物入れ", :ancestry=>"4/62"}, {:id=>690, :name=>"置時計", :ancestry=>"4/62"}, {:id=>691, :name=>"掛時計/柱時計", :ancestry=>"4/62"}, {:id=>692, :name=>"鏡(立て掛け式)", :ancestry=>"4/62"}, {:id=>693, :name=>"鏡(壁掛け式)", :ancestry=>"4/62"}, {:id=>694, :name=>"置物", :ancestry=>"4/62"}, {:id=>695, :name=>"風鈴", :ancestry=>"4/62"}, {:id=>696, :name=>"植物/観葉植物", :ancestry=>"4/62"}, {:id=>697, :name=>"その他", :ancestry=>"4/62"}, {:id=>698, :name=>"正月", :ancestry=>"4/73"}, {:id=>699, :name=>"成人式", :ancestry=>"4/73"}, {:id=>700, :name=>"バレンタインデー", :ancestry=>"4/73"} ) # BREAK EVAL Category.seed(:id, {:id=>701, :name=>"ひな祭り", :ancestry=>"4/73"}, {:id=>702, :name=>"子どもの日", :ancestry=>"4/73"}, {:id=>703, :name=>"母の日", :ancestry=>"4/73"}, {:id=>704, :name=>"父の日", :ancestry=>"4/73"}, {:id=>705, :name=>"サマーギフト/お中元", :ancestry=>"4/73"}, {:id=>706, :name=>"夏/夏休み", :ancestry=>"4/73"}, {:id=>707, :name=>"ハロウィン", :ancestry=>"4/73"}, {:id=>708, :name=>"敬老の日", :ancestry=>"4/73"}, {:id=>709, :name=>"七五三", :ancestry=>"4/73"}, {:id=>710, :name=>"お歳暮", :ancestry=>"4/73"}, {:id=>711, :name=>"クリスマス", :ancestry=>"4/73"}, {:id=>712, :name=>"冬一般", :ancestry=>"4/73"}, {:id=>713, :name=>"その他", :ancestry=>"4/73"}, {:id=>714, :name=>"文学/小説", :ancestry=>"5/75"}, {:id=>715, :name=>"人文/社会", :ancestry=>"5/75"}, {:id=>716, :name=>"ノンフィクション/教養", :ancestry=>"5/75"}, {:id=>717, :name=>"地図/旅行ガイド", :ancestry=>"5/75"}, {:id=>718, :name=>"ビジネス/経済", :ancestry=>"5/75"}, {:id=>719, :name=>"健康/医学", :ancestry=>"5/75"}, {:id=>720, :name=>"コンピュータ/IT", :ancestry=>"5/75"}, {:id=>721, :name=>"趣味/スポーツ/実用", :ancestry=>"5/75"}, {:id=>722, :name=>"住まい/暮らし/子育て", :ancestry=>"5/75"}, {:id=>723, :name=>"アート/エンタメ", :ancestry=>"5/75"}, {:id=>724, :name=>"洋書", :ancestry=>"5/75"}, {:id=>725, :name=>"絵本", :ancestry=>"5/75"}, {:id=>726, :name=>"参考書", :ancestry=>"5/75"}, {:id=>727, :name=>"その他", :ancestry=>"5/75"}, {:id=>728, :name=>"オフィス用品一般", :ancestry=>"13/157"}, {:id=>729, :name=>"オフィス家具", :ancestry=>"13/157"}, {:id=>730, :name=>"店舗用品", :ancestry=>"13/157"}, {:id=>731, :name=>"OA機器", :ancestry=>"13/157"}, {:id=>732, :name=>"ラッピング/包装", :ancestry=>"13/157"}, {:id=>733, :name=>"その他", :ancestry=>"13/157"} ) # End auto-generated file.
seedデータの投入
seed-fuでseedデータを投入します。
docker-compose run --rm web bin/rake db:migrate
カテゴリのトップページへの表示
controllerを修正します。
app/controllers/home_controller.rb
class HomeController < ApplicationController def index @categories = Category.order(:id) end end
viewを修正します。
app/views/home/_header.html.haml
.default-container %header.sp-header.visible-sp .sp-header-inner %h1.logo %a{:href => "https://www.mercari.com/jp/"} %img{:alt => "mercari", :src => "//pcweb-assets.mercdn.net/assets/img/common/common/logo.svg?3780252616"}/ .sp-header-user-nav.clearfix -# ログイン前 %a.sp-header-btn.btn-red{:href => "https://www.mercari.com/jp/signup/"} 新規会員 %a.sp-header-btn.sp-header-signup{:href => "https://www.mercari.com/jp/login/?login_callback=https%3A%2F%2Fwww.mercari.com%2Fjp%2Fcategory%2F1%2F"} ログイン -# ログイン後 -# %a.sp-header-user-icon{:href => "https://www.mercari.com/jp/mypage/notification/"} -# %figure -# = icon('far', 'bell', alt: 'bell-icon', style: 'color:#cccccc', class: 'toppage-header-top__footer-login-content--bell-icon') -# %a.sp-header-user-icon{:href => "https://www.mercari.com/jp/mypage/todo/"} -# %figure -# = icon('far', 'clock', alt: 'clock-icon', style: 'color:#cccccc', class: 'toppage-header-top__footer-login-content--clock-icon') -# %a.sp-header-user-icon.sp-header-user-profile{:href => "https://www.mercari.com/jp/mypage/"} -# %figure -# %div -# %img{:alt => "", :src => "//static.mercdn.net/images/member_photo_noimage_thumb.png", :width => "32"}/ .search-bar %form.sp-header-form{:action => "https://www.mercari.com/jp/search/"} %input.sp-header-search.input-default{:name => "keyword", :placeholder => "何をお探しですか?", :type => "search", :value => ""}/ = icon('fas', 'search', alt: 'search-icon', class: 'icon-search') %header.pc-header.visible-pc .pc-header-inner .pc-header-top %h1 %a{:href => "https://www.mercari.com/jp/"} %img{:alt => "mercari", :height => "36", :src => "//pcweb-assets.mercdn.net/assets/img/common/common/logo.svg?3780252616", :width => "134"}/ %form.pc-header-form{:action => "https://www.mercari.com/jp/search/"} %input.input-default{:name => "keyword", :placeholder => "何かお探しですか?", :type => "search", :value => ""}/ = icon('fas', 'search', alt: 'search-icon', class: 'icon-search') .pc-header-nav-box.clearfix %nav.l-left %ul.pc-header-nav %li %h2 %a.pc-header-nav-root.list-parent{:href => "https://www.mercari.com/jp/category/"} = icon('fas', 'list-ul lg', alt: 'list-icon', style: 'color:#ea352d') %span カテゴリーから探す %ul.pc-header-nav-parent-wrap{"data-mega" => "1"} - @categories.roots.each do |root_category| %li.pc-header-nav-parent %h3 %a{:href => "https://www.mercari.com/jp/category/1/"}= root_category.name %ul.pc-header-nav-child-wrap{"data-mega" => "2"} - root_category.children.each do |children_category| %li.pc-header-nav-child %a{:href => "https://www.mercari.com/jp/category/#{children_category.id}/"}= children_category.name %ul.pc-header-nav-grand-child-wrap{"data-mega" => "3"} - children_category.children.each do |children_children_category| %li.pc-header-nav-grand-child %a{:href => "https://www.mercari.com/jp/category/119/"}= children_children_category.name .l-right %ul.pc-header-login-nav %li %a.sp-header-btn.btn-red{:href => "https://www.mercari.com/jp/signup/"} 新規会員登録 %li %a.sp-header-btn.header-login{:href => "https://www.mercari.com/jp/login/?login_callback=https%3A%2F%2Fwww.mercari.com%2Fjp%2Fcategory%2F1%2F"} ログイン

コメントを残す