2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/models/old_page_attachment.rb', line 2
def create_paperclipped_record
options = {
:asset_file_size => size,
:asset_file_name => filename,
:asset_content_type => content_type,
:created_by_id => created_by
}
options[:title] = title if respond_to?(:title)
options[:caption] = description if respond_to?(:description)
a = Asset.new(options)
a.save
page = Page.find(page_id)
p = PageAttachment.create(:asset_id => a.id, :page_id => page.id)
PageAttachment.update_all("position=#{position}", "id=#{p.id}") if respond_to?(:position)
a
end
|