Module: FidorApi::Model::Helpers::ActionViewSupport

Defined in:
lib/fidor_api/model/helpers/action_view_support.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/fidor_api/model/helpers/action_view_support.rb', line 5

def self.included(base)
  base.define_singleton_method :model_name do
    ActiveModel::Name.new(self, nil, resource_name)
  end

  base.define_method :persisted? do
    respond_to?(:id) && id.present?
  end
end

Instance Method Details

#model_nameObject



15
16
17
# File 'lib/fidor_api/model/helpers/action_view_support.rb', line 15

def model_name
  self.class.model_name
end