Sha256: b77e752f02344cd59b81e0c6e4173622c66e221796af5ba22217cac720509640
Contents?: true
Size: 801 Bytes
Versions: 1
Compression:
Stored size: 801 Bytes
Contents
module Nameable extend ActiveSupport::Concern include FieldsValidator included do validate_required_attributes end class_methods do def required_attributes result=defined?(super) ? super : [] result+=required_nameable_attributes end def required_database_fields result=defined?(super) ? super : [] result+=[:firstname, :lastname] end def required_nameable_attributes [:firstname,:lastname] end end public def first_name firstname end def first_name=(thing) self.firstname=thing end def full_name "#{firstname} #{lastname}" end def proper_name "#{lastname.upcase}, #{firstname}" end def surname lastname end def surname=(thing) self.lastname=thing end private end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
morse_nameable-1.1.0 | lib/nameable.rb |