FIX: Possible 500 error if category saved incorrectly

This commit is contained in:
Robin Ward
2017-05-08 15:17:58 -04:00
parent 4f6e5fed2a
commit afe04b8bbb
2 changed files with 16 additions and 5 deletions

View File

@ -110,10 +110,13 @@ class ListController < ApplicationController
end
def category_default
if @category.default_view == 'top'
view_method = @category.default_view
view_method = 'latest' unless %w(latest top).include?(view_method)
if view_method == 'top'
top(category: @category.id)
else
self.send(@category.default_view || 'latest')
self.send(view_method)
end
end