diff --git a/app/models/patent.rb b/app/models/patent.rb index cec7330..c13a01f 100644 --- a/app/models/patent.rb +++ b/app/models/patent.rb @@ -29,6 +29,8 @@ class Patent before_validation :add_http + scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year => "desc", :publish_date => "desc") } + def get_plugin_data(fields_to_show) plugin_datas = [] fields_to_show.each do |field| @@ -55,7 +57,7 @@ class Patent } 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| diff --git a/app/views/admin/patents/_form.html.erb b/app/views/admin/patents/_form.html.erb index decf243..2c4273f 100644 --- a/app/views/admin/patents/_form.html.erb +++ b/app/views/admin/patents/_form.html.erb @@ -180,7 +180,7 @@