Class: Yaks::Mapper::HasOne

Inherits:
Association show all
Defined in:
lib/yaks/mapper/has_one.rb

Instance Method Summary collapse

Methods inherited from Association

#add_to_resource, create, #map_rel, #render_as_link?, #resolve_association_mapper

Methods included from Util

#Resolve, #camelize, #extract_options, #reject_keys, #slice_hash, #symbolize_keys, #underscore

Instance Method Details

#map_resource(object, context) ⇒ Object



4
5
6
7
8
# File 'lib/yaks/mapper/has_one.rb', line 4

def map_resource(object, context)
  resolve_association_mapper(context.fetch(:policy))
    .new(context)
    .call(object)
end

#singular_nameObject



10
11
12
# File 'lib/yaks/mapper/has_one.rb', line 10

def singular_name
  name.to_s
end