Sha256: 90e0049495c59488f6931acd1d8728b3a8a07f2943e0d168617c654a2e2624f7

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

module Soulless
  module Model
    def self.included(base)
      base.class_eval do
        extend ActiveModel::Naming
        extend ActiveModel::Translation
        include ActiveModel::Conversion
        include ActiveModel::Dirty
        include ActiveModel::Validations
        
        class << self
          def i18n_scope
            :soulless
          end
        end
        
        def persisted?
          false
        end
    
        def save
          if valid?
            persist!
            changes_applied
            true
          else
            false
          end
        end
    
        def update_attributes(attributes)
          self.attributes = attributes
          save
        end
    
        private
        def persist!
          raise 'Method persist! not defined...'
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soulless-0.3.0 lib/soulless/model.rb