lib/has_details.rb
# Configuration options are:
#
# * +column+ - Specifies the column name to use for storing the serialized attributes. This column will automatically be set to serialize in Rails. The default value is :details.
#
# The rest of the configuration options is the set of attributes that will be saved in the +column+. Valid formats are:
# * +:field => ClassName+ (values assigned to +field+ must be of class +ClassName+)
# * +:field => [:symbol, :othersymbol]+  (values assigned to +field+ must be included in the array given)
Configuration options are:
+column+ - Specifies the column name to use for storing the serialized attributes. This column will automatically be set to serialize in Rails. The default value is :details.

The rest of the configuration options is the set of attributes that will be saved in the +column+.
Configuration options are : + column + - Specifies the column name to use for storing the serialized attributes . This column will automatically be set to serialize in Rails . The default value is : details . The rest of the configuration options is the set of attributes that will be saved in the + column + .
def has_details(options = {})
      configuration = { :column => :details}
      configuration.update(options) if options.is_a?(Hash)
      column = configuration[:column]
      raise(ArgumentError, "You must be supply at least one field in the configuration hash") unless configuration.keys.size > 0
      raise(Exception, "A #{column.inspect} column must be present in the database for this plugin.") unless column_names.include?(column.to_s)
      serialize column, Hash
      configuration.each do |f,t|
        unless f == :column
          exception_code = t.is_a?(Array) ? "raise \"Assigned value must be one of #{t.inspect}\" unless #{t.inspect}.include?(val)" : \
                                            "raise \"Assigned value must be a #{t.inspect}\" unless val.is_a?(#{t.inspect})"
          class_eval <<-EOV
            def #{f}
              self.#{column.to_s} ||= {}
              self.#{column.to_s}[:#{f}]
            end
            def #{f}=(val)
              #{exception_code}
              self.#{column.to_s} ||= {}
              self.#{column.to_s}[:#{f}] = val
            end
          EOV
        end
      end
    end
def has_details ( options = { } ) configuration = { :column => :details } configuration . update ( options ) if options . is_a? ( Hash ) column = configuration [ :column ] raise ( ArgumentError , "You must be supply at least one field in the configuration hash" ) unless configuration . keys . size > 0 raise ( Exception , "A #{column.inspect} column must be present in the database for this plugin." ) unless column_names . include? ( column . to_s ) serialize column , Hash configuration . each do | f , t | unless f == :column exception_code = t . is_a? ( Array ) ? "raise \"Assigned value must be one of #{t.inspect}\" unless #{t.inspect}.include?(val)" : "raise \"Assigned value must be a #{t.inspect}\" unless val.is_a?(#{t.inspect})" class_eval <<-EOV 
            def  #{ f } 
              self. #{ column . to_s }  ||= {}
              self. #{ column . to_s } [: #{ f } ]
            end

            def  #{ f } =(val)
               #{ exception_code } 

              self. #{ column . to_s }  ||= {}
              self. #{ column . to_s } [: #{ f } ] = val
            end
           EOV end end end
Configuration options are:
 +column+ - Specifies the column name to use for storing the serialized attributes.
Configuration options are : + column + - Specifies the column name to use for storing the serialized attributes .
options
<not_specific>