lib/attached.rb in attached-0.5.1 vs lib/attached.rb in attached-0.5.2

- old
+ new

@@ -5,10 +5,11 @@ module Attached def self.included(base) base.extend ClassMethods + base.class_attribute :attached_options end module Definition def attachment(*args) @@ -24,24 +25,10 @@ module ClassMethods - # Initialize attached options used for communicating between class and instance methods. - - def initialize_attached_options - write_inheritable_attribute(:attached_options, {}) - end - - - # Access attached options used for communicating between class and instance methods. - - def attached_options - read_inheritable_attribute(:attached_options) - end - - # Add an attachment to a class. # # Options: # # * :styles - a hash containing style names followed by parameters passed to processor @@ -56,11 +43,11 @@ def has_attached(name, options = {}) include InstanceMethods - initialize_attached_options unless attached_options - attached_options[name] = options + self.attached_options ||= {} + self.attached_options[name] = options before_save :save_attached before_destroy :destroy_attached define_method name do \ No newline at end of file