My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Links

Rails Plugin: has_file v0.1

Website: http://code.google.com/p/rails-has-file
Author: John Wulff <johnw@orcasnet.com>
Copyright: Copyright (c) 2007 John Wulff <johnw@orcasnet.com>
License: MIT <http://www.opensource.org/licenses/mit-license.php>

SETUP

  class Node < ActiveRecord::Base
    has_file :donkey
  end

BEHAVIOUR

  >> n = Node.new
    => #<Node:0x2661e04 @attributes={'created_at'=>nil}, @new_record=true>
  >> n.donkey = 'secret donkey message'
    => 'secret donkey message'
  >> n.donkey_file_path
    => '/tmp/node-20123394-donkey'
  >> n.donkey
    => 'secret donkey message'
  >> n.save!
    => true
  >> n.donkey_file_path
    => '/Users/jwulff/Development/rails/resources/node-4-donkey'
  >> n.donkey
    => 'secret donkey message'
  >> n.destroy
    => #<Node:0x2661e04 @attributes={'created_at'=>'2007-05-08 15:07:47'}>
  >> File.exists? '/Users/jwulff/Development/rails/resources/node-4-donkey'
    => false
Powered by Google Project Hosting