Sha256: 733397b9c143306ccb3763901e0fe10bc65a34d02e11095fe3afd55fa891e9a1
Contents?: true
Size: 577 Bytes
Versions: 20
Compression:
Stored size: 577 Bytes
Contents
module AngularSprinkles class ModelDecorator < SimpleDelegator def initialize(args) @key = args.fetch(:key) @json_wrapper = args.fetch(:json_wrapper) @object_wrapper = args.fetch(:object_wrapper) @object = args.fetch(:object) super(@object) end def bind(attribute = nil) @object_wrapper.new(@key, attribute, @json_wrapper) end ## # Rails uses #class as a part of #form_for to create labels. # Delegate this method to the model class to prevent this issue. def class @object.class end end end
Version data entries
20 entries across 20 versions & 1 rubygems