app/models/dc_menu.rb in drg_cms-0.5.52 vs app/models/dc_menu.rb in drg_cms-0.5.52.2
- old
+ new
@@ -115,16 +115,14 @@
# Array. Of choices prepared for tree:select input field.
#######################################################################
def self.choices4_menu_as_tree(site_id=nil)
qry = where(active: true)
#
- ar = [nil]
if site_id.class == BSON::ObjectId
- ar << site_id
+ qry.in( dc_site_id: [nil, site_id] )
elsif site_id.respond_to?(:id)
- ar << site_id.id
+ qry.in( dc_site_id: [nil, site_id.id] )
end
- qry = qry.in(dc_site_id: ar)
#
result = []
qry.each do |menu|
result << [menu.name, menu.id, nil,0]
sub_menus = menu.dc_menu_items.order_by(order: 1).to_a