Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
cea1a987
Commit
cea1a987
authored
Aug 04, 2010
by
Tim Felgentreff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix display of attachments with acts_as_journalized
parent
f45bb1e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
attachment.rb
app/models/attachment.rb
+14
-14
No files found.
app/models/attachment.rb
View file @
cea1a987
...
...
@@ -28,23 +28,23 @@ class Attachment < ActiveRecord::Base
acts_as_journalized
:event_title
=>
:filename
,
:event_url
=>
(
Proc
.
new
do
|
o
|
{
:controller
=>
'attachments'
,
:action
=>
'download'
,
:id
=>
o
.
id
,
:filename
=>
o
.
filename
}
:id
=>
o
.
versioned_
id
,
:filename
=>
o
.
filename
}
end
),
:activity_type
=>
'files'
,
:activity_permission
=>
:view_files
,
:activity_find_options
=>
{
:select
=>
"
#{
Attachment
.
table_name
}
.*"
,
:joins
=>
"LEFT JOIN
#{
Version
.
table_name
}
ON
#{
Version
.
table_name
}
.id =
#{
Attachment
.
table_name
}
.container_id "
+
" AND
#{
Attachment
.
table_name
}
.container_type = 'Version' "
+
"LEFT JOIN
#{
Project
.
table_name
}
ON
#{
Project
.
table_name
}
.id =
#{
Version
.
table_name
}
.project_id "
+
" OR (
#{
Attachment
.
table_name
}
.container_id =
#{
Project
.
table_name
}
.id "
+
" AND
#{
Attachment
.
table_name
}
.container_type = 'Project' ) "
}
:activity_permission
=>
:view_files
acts_as_activity
:type
=>
'documents'
,
:permission
=>
:view_documents
,
:find_options
=>
{
:select
=>
"
#{
Attachment
.
table_name
}
.*"
,
:joins
=>
"LEFT JOIN
#{
Document
.
table_name
}
ON (
#{
Document
.
table_name
}
.id =
#{
Attachment
.
table_name
}
.container_id"
+
" AND
#{
Attachment
.
table_name
}
.container_type='Document') "
+
"LEFT JOIN
#{
Project
.
table_name
}
ON (
#{
Project
.
table_name
}
.id =
#{
Document
.
table_name
}
.project_id)"
}
acts_as_activity
:type
=>
'documents'
,
:permission
=>
:view_documents
def
activity_type
case
container_type
when
"Document"
"documents"
when
"Version"
"files"
else
super
end
end
cattr_accessor
:storage_path
@@storage_path
=
"
#{
RAILS_ROOT
}
/files"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment