Displaying 1 result from an estimated 1 matches for "attachment_path_id".
2007 Mar 04
3
Dynamically setting the image directory used by attachment_fu
...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_many :item_images,
:conditions => "parent_id is null"
Now all the directories will be grouped by the item...