Displaying 5 results from an estimated 5 matches for "thumbnail_class".
2007 Mar 04
3
Dynamically setting the image directory used by attachment_fu
...he related item is associated to the thumbnail child
before_thumbnail_saved do |record, thumbnail|
thumbnail.item = record.item
end
def full_filename(thumbnail = nil)
# Just to be sure the ID gets set
raise "Missing Item ID" if item_id.nil?
file_system_path = (thumbnail ? thumbnail_class :
self).attachment_options[:path_prefix].to_s
File.join(RAILS_ROOT, file_system_path, item_id.to_s,
attachment_path_id, thumbnail_name_for(thumbnail))
end
and in your Item class you add a condition since it makes it easier to
iterate over the images and for example call the image helpers
has_...
2007 Aug 22
8
How to spec an attachment_fu model
First off, I''m not trying to spec attachment_fu, I know it''s been tested.
But, I added some code to that model that I do need to test. Basically,
I need to somehow fulfill the "uploaded_data" property so I can actually
run my tests(otherwise they fail because of validations). The
"uploaded_data" field is what would grab the multipart data from form.
Here
2010 Jul 11
0
Attachement_fu error when updating existing photos
...le_name} is the default filesystem path
# RAILS_ROOT/public/my_models/5/blah.jpg
#
# Overwrite this method in your model to customize the filename.
# The optional thumbnail argument will output the thumbnail''s filename.
def full_filename(thumbnail = nil)
file_system_path = (thumbnail ? thumbnail_class :
self).attachment_options[:path_prefix].to_s
File.join(RAILS_ROOT, file_system_path,
*partitioned_path(thumbnail_name_for(thumbnail)))
end
Anybody have an idea what I am doing wrong?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Goo...
2007 Sep 18
2
Making attachment_fu polymorphic
I am working on a small model mixin called attachment_kung to make
attachment_fu polymorphic, so you no longer need a different table and
Model class for every associated attachment (Productimage, Ad_doc,
etc). All you really need is one model and table to handel all your
attachments - in some cases, anyway. I have the code working, but have
run into one small hitch that I can''t seem to
2007 Dec 13
4
Attachment_fu problems on updates
...through => :group_members
has_one :photo, :as => "photo_for"
validates_associated :photo
end
Here is the file_system_backend (where the error is occurring):
-----------------------------------------------
def full_filename(thumbnail = nil)
file_system_path = (thumbnail ? thumbnail_class :
self).attachment_options[:path_prefix].to_s
#here is the join that is failing
#logger.info "rails root:" + RAILS_ROOT => /Users/...
#logger.info "file sys path" + file_system_path => public/photos
#logger.info thumbnail => nothing show up here...