Sha256: c5b20430dc058b3326332f656c47fc1c1ed784cd7f7933e44618b21043a25c03

Contents?: true

Size: 685 Bytes

Versions: 6

Compression:

Stored size: 685 Bytes

Contents

# This is the module which makes any class behave like ActiveModel.
module Basepack
  module Model
    extend ActiveSupport::Concern

    included do
      extend ActiveModel::Callbacks
      include ActiveModel::Model
      include ActiveModel::Serialization
      include ActiveModel::ForbiddenAttributesProtection
      include ActiveModel::AttributeMethods
      include ActiveModel::Dirty
    end

    # Always return true so when using form_for, the default method will be post.
    def new_record?
      true
    end

    # Always return nil so when using form_for, the default method will be post.
    def id
      nil
    end

    def destroyed?
      true
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
basepack-1.0.1 lib/basepack/model.rb
basepack-1.0.0 lib/basepack/model.rb
basepack-1.0.0.pre.0 lib/basepack/model.rb
basepack-0.2.0 lib/basepack/model.rb
basepack-0.1.0 lib/basepack/model.rb
basepack-0.0.2 lib/basepack/model.rb