added menu sub sub items (horrible name i know)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
get '/menuitem' do
|
||||
# list all menu items
|
||||
MenuItem.eager_load(:menu_sub_items).order("menu_items.ordinal, menu_sub_items.ordinal").to_json(:include => [:menu_sub_items])
|
||||
MenuItem.eager_load(menu_sub_items: :menu_sub_sub_items)
|
||||
.order("menu_items.ordinal, menu_sub_items.ordinal, menu_sub_sub_items.ordinal")
|
||||
.to_json(:include => [:menu_sub_items => {:include => :menu_sub_sub_items}])
|
||||
end
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class CreateMenuSubSubItem < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :menu_sub_sub_items do |t|
|
||||
t.string :title
|
||||
t.string :url
|
||||
t.integer :ordinal
|
||||
t.integer :menu_sub_item_id
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20150404114006) do
|
||||
ActiveRecord::Schema.define(version: 20150414214540) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -117,7 +117,7 @@ ActiveRecord::Schema.define(version: 20150404114006) do
|
||||
t.decimal "current_input_price", precision: 5, scale: 2
|
||||
t.decimal "list_price", precision: 5, scale: 2
|
||||
t.integer "unit_id"
|
||||
t.decimal "units_in_pack", precision: 5, scale: 3
|
||||
t.decimal "units_in_pack", precision: 6, scale: 2
|
||||
t.text "description"
|
||||
t.integer "sub_category_id"
|
||||
t.integer "stock"
|
||||
@@ -126,8 +126,8 @@ ActiveRecord::Schema.define(version: 20150404114006) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "tags"
|
||||
t.json "traits"
|
||||
t.integer "supplier_id"
|
||||
t.decimal "weight", precision: 5, scale: 3
|
||||
t.integer "supplier_id"
|
||||
t.integer "delivery_time_estimation_id"
|
||||
t.integer "brand_id"
|
||||
end
|
||||
@@ -168,6 +168,13 @@ ActiveRecord::Schema.define(version: 20150404114006) do
|
||||
t.integer "menu_item_id"
|
||||
end
|
||||
|
||||
create_table "menu_sub_sub_items", force: :cascade do |t|
|
||||
t.string "title"
|
||||
t.string "url"
|
||||
t.integer "ordinal"
|
||||
t.integer "menu_sub_item_id"
|
||||
end
|
||||
|
||||
create_table "multi_media_descriptions", force: :cascade do |t|
|
||||
t.string "url"
|
||||
t.integer "item_id"
|
||||
@@ -190,11 +197,9 @@ ActiveRecord::Schema.define(version: 20150404114006) do
|
||||
end
|
||||
|
||||
create_table "sub_categories", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.integer "category_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "order"
|
||||
t.string "name"
|
||||
t.integer "category_id"
|
||||
t.integer "order"
|
||||
end
|
||||
|
||||
create_table "suppliers", force: :cascade do |t|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
class MenuSubItem < ActiveRecord::Base
|
||||
belongs_to :menu_item
|
||||
has_many :menu_sub_sub_items
|
||||
end
|
||||
|
||||
3
front-api/models/menu_sub_sub_item.rb
Normal file
3
front-api/models/menu_sub_sub_item.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class MenuSubSubItem < ActiveRecord::Base
|
||||
belongs_to :menu_sub_item
|
||||
end
|
||||
Reference in New Issue
Block a user