osaka menu rake

This commit is contained in:
Yan
2017-07-11 19:21:17 +06:30
parent 39aca095fb
commit b47e0d0548
4 changed files with 63 additions and 65 deletions

View File

@@ -1,5 +1,4 @@
class MenuCategory < ApplicationRecord
class MenuCategory < ApplicationRecord
before_create :generate_menu_category_code
belongs_to :menu
@@ -7,7 +6,7 @@ class MenuCategory < ApplicationRecord
belongs_to :parent, :class_name => "MenuCategory", foreign_key: "menu_category_id", optional: true
has_many :menu_items
validates_presence_of :name, :menu, :code, :order_by
validates_presence_of :name, :menu, :order_by
default_scope { order('order_by asc') }
@@ -38,7 +37,7 @@ class MenuCategory < ApplicationRecord
private
def generate_menu_category_code
self.code = SeedGenerator.generate_code(self.class.name, "C")
def generate_menu_category_code
self.code = SeedGenerator.generate_code(self.class.name, "C")
end
end