Sha256: 9bf99b84106f69d07f5a8ab853dfe4cfa521303c3fc7a851cf7706f9884e0053
Contents?: true
Size: 831 Bytes
Versions: 1
Compression:
Stored size: 831 Bytes
Contents
require "findable/schema/conversion" module Findable module Schema extend ActiveSupport::Concern included do attribute_method_suffix "=" attribute_method_suffix "?" end module ClassMethods def column_names @_column_names ||= [:id] end def define_field(*args) options = args.extract_options! name = args.first if !public_method_defined?(name) || options.present? define_attribute_methods name conversion = Conversion.for(options[:type]) define_method(name) { conversion.call(attributes[name.to_sym]) } column_names << name.to_sym end end end def attribute=(attr, value) attributes[attr] = value end def attribute?(attr) attributes[attr].present? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
findable-0.2.0 | lib/findable/schema.rb |