Fix bug.
This commit is contained in:
parent
7711a3183e
commit
0e9168634f
|
@ -19,10 +19,12 @@ class AsksController < ApplicationController
|
|||
else
|
||||
categories = Category.where(:id.in=>OrbitHelper.widget_categories).enabled
|
||||
end
|
||||
if (module_app.asc rescue true)
|
||||
categories = categories.sort_by{|category| (category.sort_number.to_i rescue category.id)}
|
||||
else
|
||||
categories = categories.sort_by{|category| (-category.sort_number.to_i rescue category.id)}
|
||||
unless Category.respond_to?(:sorted)
|
||||
if (module_app.asc rescue true)
|
||||
categories = categories.sort_by{|category| (category.sort_number.to_i rescue category.id)}
|
||||
else
|
||||
categories = categories.sort_by{|category| (-category.sort_number.to_i rescue category.id)}
|
||||
end
|
||||
end
|
||||
tags = module_app.tags
|
||||
ask_question = AskQuestion.new
|
||||
|
@ -132,10 +134,12 @@ class AsksController < ApplicationController
|
|||
else
|
||||
categories = Category.where(:id.in=>OrbitHelper.page_categories).enabled
|
||||
end
|
||||
if (module_app.asc rescue true)
|
||||
categories = categories.sort_by{|category| (category.sort_number.to_i rescue category.id)}
|
||||
else
|
||||
categories = categories.sort_by{|category| (-category.sort_number.to_i rescue category.id)}
|
||||
unless Category.respond_to?(:sorted)
|
||||
if (module_app.asc rescue true)
|
||||
categories = categories.sort_by{|category| (category.sort_number.to_i rescue category.id)}
|
||||
else
|
||||
categories = categories.sort_by{|category| (-category.sort_number.to_i rescue category.id)}
|
||||
end
|
||||
end
|
||||
category_ids = categories.collect{|v| v.id.to_s}
|
||||
ask_settings = AskCategorySetting.enabled.where(:category_id.in=> category_ids).to_a
|
||||
|
|
Loading…
Reference in New Issue