From 4c5f32ac2873a79a0f786db8d4605381994164ec Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Sun, 16 May 2021 21:11:57 +0200 Subject: [PATCH] suite --- app/controllers/admin/data_files_controller.rb | 4 ++-- app/controllers/admin/image_files_controller.rb | 4 ++-- app/controllers/public/testimonies_controller.rb | 2 +- app/views/admin/blocks/_block.html.haml | 2 +- app/views/admin/menu_aliases/_form.html.haml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/admin/data_files_controller.rb b/app/controllers/admin/data_files_controller.rb index 9852d7c..1e2b3ce 100644 --- a/app/controllers/admin/data_files_controller.rb +++ b/app/controllers/admin/data_files_controller.rb @@ -9,8 +9,8 @@ params[:file_folder_id] = params[:file_folder_id] || 1 @file_folder = FileFolder.find(params[:file_folder_id]) - @file_folders = FileFolder.all(:order => :name) - @data_files = DataFile.all(:order => "created_at DESC", :conditions => {:file_folder_id => @file_folder.id}) + @file_folders = FileFolder.order("name").all + @data_files = DataFile.order("created_at DESC").where(:file_folder_id => @file_folder.id).all @data_file = DataFile.new(:file_folder_id => @file_folder.id) if request.xhr? render :layout => false diff --git a/app/controllers/admin/image_files_controller.rb b/app/controllers/admin/image_files_controller.rb index 12da766..6cead9f 100644 --- a/app/controllers/admin/image_files_controller.rb +++ b/app/controllers/admin/image_files_controller.rb @@ -8,8 +8,8 @@ params[:album_id] = params[:album_id] || 1 @album = Album.find(params[:album_id]) - @albums = Album.all(:order => :name) - @image_files = ImageFile.all(:order => "created_at DESC", :conditions => {:album_id => @album.id}) + @albums = Album.order("name").all + @image_files = ImageFile.where(:album_id => @album.id).order("created_at DESC").all @image_file = ImageFile.new(:album_id => @album.id) if request.xhr? render :layout => false diff --git a/app/controllers/public/testimonies_controller.rb b/app/controllers/public/testimonies_controller.rb index f09c649..969eaa8 100644 --- a/app/controllers/public/testimonies_controller.rb +++ b/app/controllers/public/testimonies_controller.rb @@ -9,7 +9,7 @@ class Public::TestimoniesController < ApplicationController if params[:slug] testimony_id = params[:slug].split('-')[0].to_i - testimony = Testimony.find(:first, :conditions => {:id => testimony_id}) + testimony = Testimony.where(:id => testimony_id).first if testimony @testimony = testimony diff --git a/app/views/admin/blocks/_block.html.haml b/app/views/admin/blocks/_block.html.haml index fc0a661..171b664 100644 --- a/app/views/admin/blocks/_block.html.haml +++ b/app/views/admin/blocks/_block.html.haml @@ -3,6 +3,6 @@ #block_portlet.block_portlets{:id => block.id, :"data-block_id"=>block.id, :class => ("block_portlets_sortable" if sortable).to_s} - =render :partial => "portlet/portlets/portlet", :collection => block.portlets.find(:all, :order => :position, :include => :content) + =render :partial => "portlet/portlets/portlet", :collection => block.portlets.order(:position).includes(:content).all diff --git a/app/views/admin/menu_aliases/_form.html.haml b/app/views/admin/menu_aliases/_form.html.haml index 5b91a46..6803c36 100644 --- a/app/views/admin/menu_aliases/_form.html.haml +++ b/app/views/admin/menu_aliases/_form.html.haml @@ -2,5 +2,5 @@ =form.semantic_fields_for :menu_content do |content| = content.inputs do - -MenuItem.find(:all, :conditions => {:parent_id => nil}, :order => :position).each do |m| + -MenuItem.where(:parent_id => nil).order(:position).all.each do |m| =render :partial => "form_line", :locals => {:menu_item => m, :f => content} \ No newline at end of file