Displaying 3 results from an estimated 3 matches for "attachment_model".
2006 Nov 20
7
Acts as attachement
...d method `content_type''
I have set everything up according to the following page however i am
still have trouble
http://weblog.techno-weenie.net/articles/acts_as_attachment
One thing, I have wanted to add this to an existing model in my system.
I have not used the...
script/generate attachment_model dvd_cover
to create my model it was already there. But i have added in all the
lines that are needed. Any ideas about what i am doing wrong?
Thanks for your time reading this
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this mes...
2006 Sep 08
4
Does acts_as_attachment :storage => :db_system work?
I found the post about needing to install acts_as_attachement_1_1_6 if
you are not on edge rails. But I am having trouble getting db_system
storage to work. As far as I can tell in from the database, things are
working, but I don''t see how my model table hooks up with the db_files
table so I am having trouble altering the image_tag from the tutorial
2006 Jul 03
0
Multiple File Upload
...ontroller.rb:
----------------------
def upload_attachment
project = Project.find(@params[:id])
begin
project.attachments.create(params[:attachment])
rescue
flash[:attachment_error] = "Error at Upload"
end
redirect_to :action => "edit_project", :id => project
end
attachment_model:
-----------------
def attachment=(attachment_field)
self.name = base_part_of(attachment_field.original_filename)
self.content_type = attachment_field.content_type.chomp
self.data = attachment_field.read
end
def base_part_of file_name
name = File.basename(file_name)
name.gsub(/[^\w._-]/, '...