Asset Field plugin

Plugin details

Adds asset management capabilities to your model.

Websitehttp://www.planetargon.org/trac/browser/rails/plugins/asset_field Repositoryhttp://svn.planetargon.org/rails/plugins/asset_field/ Author Jeremy Voorhis Tags asset LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://svn.planetargon.org/rails/plugins/asset_field/

Usage example

  class Page
    asset_field :asset,
        :directory  => "#{RAILS_ROOT}/public/assets/images",
        :extensions => %w( .swf .qt ),
        :filename   => :permalink
  end



This defines the following attrbitues:

[R,W] asset_tempfile


and the following instance methods:

Page#asset_file_on_disk Full pathname of the file on disk.
Page#asset_exist?       Does the file actually exist on disk?
Page#write_asset_file   Write the file to the path generated from the asset field's directory option and the method referenced by the filename option.
Page#destroy_asset_file Destroy the asset file.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 9 months ago