parent
e56382a899
commit
fd2197a73d
|
@ -268,6 +268,8 @@ class FilesController < ApplicationController
|
||||||
else
|
else
|
||||||
sort = "#{Attachment.table_name}.created_on desc"
|
sort = "#{Attachment.table_name}.created_on desc"
|
||||||
end
|
end
|
||||||
|
# @containers = [ Project.includes(:attachments).find(@project.id)]
|
||||||
|
# @containers += @project.versions.includes(:attachments).all
|
||||||
|
|
||||||
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
|
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
|
||||||
|
|
||||||
|
|
|
@ -618,7 +618,7 @@ class Attachment < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def update_attachment_ealasticsearch_index
|
def update_attachment_ealasticsearch_index
|
||||||
if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
|
if self.is_public == 1 && ( ((self.container_type == 'Project' or self.container_type == 'Version') && Project.find(self.container_id).is_public == 1) ||
|
||||||
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
|
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
|
||||||
self.container_type == 'Principal')
|
self.container_type == 'Principal')
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class ChangeAttachmentHistory < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
attachments = Attachment.where("container_type =?", "Version")
|
||||||
|
attachments.each do |am|
|
||||||
|
am.update_attribute(:container_type, "Project") unless am.nil?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20160105073350) do
|
ActiveRecord::Schema.define(:version => 20160108021447) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue