lib/fleximage/model.rb
# Returns the path to the master image file for this record.
#   
#   @some_image.directory_path #=> /var/www/myapp/uploaded_images
#
# If this model has a created_at field, it will use a directory 
# structure based on the creation date, to prevent hitting the OS imposed
# limit on the number files in a directory.
#
#   @some_image.directory_path #=> /var/www/myapp/uploaded_images/2008/3/30
Returns the path to the master image file for this record.

If this model has a created_at field, it will use a directory
structure based on the creation date, to prevent hitting the OS imposed
limit on the number files in a directory.


Returns the path to the master image file for this record . If this model has a created_at field it will use a directory structure based on the creation date to prevent hitting the OS imposed limit on the number files in a directory .
def directory_path
        directory = self.class.image_directory
        raise 'No image directory was defined, cannot generate path' unless directory
        directory = "#{RAILS_ROOT}/#{directory}" unless /^\// =~ directory
        creation = self[:created_at] || self[:created_on]
        if self.class.use_creation_date_based_directories && creation 
          "#{directory}/#{creation.year}/#{creation.month}/#{creation.day}"
        else
          directory
        end
      end
def directory_path directory = self . class . image_directory raise 'No image directory was defined, cannot generate path' unless directory directory = "#{RAILS_ROOT}/#{directory}" unless / ^ \/ / =~ directory creation = self [ :created_at ] || self [ :created_on ] if self . class . use_creation_date_based_directories && creation "#{directory}/#{creation.year}/#{creation.month}/#{creation.day}" else directory end end
Returns the path to the master image file for this record.
Returns the path to the master image file for this record .
# base directory # specific creation date based directory suffix.