From 549ee9daa247c2ab281dbdc1555024331b6363d5 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 8 Apr 2016 10:41:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=9D=9E=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E7=9A=84=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4fa7659c9..a24bcd9a4 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -79,8 +79,8 @@ class OrganizationsController < ApplicationController if @organization.show_mode == 1 && params[:org_subfield_id].nil? && params[:list] .nil? if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) # REDO:时间紧,暂时先这样 - @org_logo_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 0).order("created_on desc").first - @org_banner_attchment = Attachment.where("container_id =? and container_type =? and attachtype =?", @organization, "Organization", 1).order("created_on desc").first + @org_logo_attchment = Attachment.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 0 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first + @org_banner_attchment = Attachment.find_by_sql("SELECT * from attachments WHERE container_id = #{@organization.id} and container_type = 'Organization' and attachtype = 1 and filename REGEXP '(.jpg|.png|.bmp|.gif|.jpeg)' ORDER BY created_on desc limit 1").first @subfield_content = @organization.org_subfields.order("priority") @organization = Organization.find(params[:id])