diff --git a/app/models/lab.rb b/app/models/lab.rb index 897bb44..8af1121 100644 --- a/app/models/lab.rb +++ b/app/models/lab.rb @@ -29,6 +29,8 @@ class Lab before_validation :add_http + scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year => "desc") } + def get_plugin_data(fields_to_show) plugin_datas = [] fields_to_show.each do |field| @@ -53,7 +55,7 @@ class Lab } end - plugin_datas = datas.where(:is_hidden=>false).order_by(:year=>'desc').collect do |p| + plugin_datas = datas.sort_for_frontend.collect do |p| pd_data = [] fields_to_show.collect do |t|