class AngularSprinkles::ModelDecorator

Public Class Methods

new(args) click to toggle source
Calls superclass method
# File lib/angular_sprinkles/model_decorator.rb, line 3
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

Public Instance Methods

bind(attribute = nil) click to toggle source
# File lib/angular_sprinkles/model_decorator.rb, line 12
def bind(attribute = nil)
  @object_wrapper.new(@key, attribute, @json_wrapper)
end
class() click to toggle source

Rails uses class as a part of form_for to create labels. Delegate this method to the model class to prevent this issue.

# File lib/angular_sprinkles/model_decorator.rb, line 19
def class
  @object.class
end