Module: ActsAsApi::Base

Defined in:
lib/acts_as_api/base.rb

Overview

This module enriches the ActiveRecord::Base module of Rails.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Instance Method Summary collapse

Instance Method Details

#acts_as_api {|ActsAsApi::Config| ... } ⇒ Object

When invoked, it enriches the current model with the class and instance methods to act as api.

Yields:


14
15
16
17
18
19
20
21
# File 'lib/acts_as_api/base.rb', line 14

def acts_as_api
  class_eval do
    include ActsAsApi::Base::InstanceMethods
    extend ActsAsApi::Base::ClassMethods
  end

  yield ActsAsApi::Config if block_given?
end

#acts_as_api?Boolean

Indicates if the current model acts as api. False by default.

Returns:

  • (Boolean)

8
9
10
# File 'lib/acts_as_api/base.rb', line 8

def acts_as_api?
  false
end