Fix get_viewable
This commit is contained in:
parent
2265b0b404
commit
1ba1703e90
|
@ -230,7 +230,6 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_sorted_and_filtered(object_class, query = nil, objects = nil)
|
def get_sorted_and_filtered(object_class, query = nil, objects = nil)
|
||||||
object_class = object_class.classify.constantize
|
|
||||||
if params[:filter] || params[:sort] || params[:new_filter]
|
if params[:filter] || params[:sort] || params[:new_filter]
|
||||||
@filter = params[:filter]
|
@filter = params[:filter]
|
||||||
new_filter = params[:new_filter]
|
new_filter = params[:new_filter]
|
||||||
|
@ -249,6 +248,7 @@ class ApplicationController < ActionController::Base
|
||||||
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
object_class = object_class.classify.constantize
|
||||||
objects ||= get_objects(object_class, query)
|
objects ||= get_objects(object_class, query)
|
||||||
unless params[:sort].blank?
|
unless params[:sort].blank?
|
||||||
options = params[:sort_options]
|
options = params[:sort_options]
|
||||||
|
@ -390,6 +390,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
|
|
||||||
def get_viewable(object_class, query=nil)
|
def get_viewable(object_class, query=nil)
|
||||||
|
object_class = object_class.classify.constantize
|
||||||
get_objects(object_class,query).order_by(:created_at, :desc)
|
get_objects(object_class,query).order_by(:created_at, :desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Reference in New Issue