lib/daylight/resource_proxy.rb
##
# Create a wrapper method around a called array method that updates the assocation
# resource if the array has changed.
# This way we can propagate those changes to the server when the client model is saved.
Create a wrapper method around a called array method that updates the assocation
resource if the array has changed.
This way we can propagate those changes to the server when the client model is saved.
Create a wrapper method around a called array method that updates the assocation resource if the array has changed . This way we can propagate those changes to the server when the client model is saved .
def wrap_array_method(method_name)
      self.class.send(:define_method, method_name) do |*args, &block|
        array = records.elements
        count_before = array.count
        response = array.send(method_name, *args, &block)
        association_resource.send("#{association_name}=", array) if association_name && count_before != array.count
        response
      end
    end
def wrap_array_method ( method_name ) self . class . send ( :define_method , method_name ) do | * args , & block | array = records . elements count_before = array . count response = array . send ( method_name , * args , & block ) association_resource . send ( "#{association_name}=" , array ) if association_name && count_before != array . count response end end
Create a wrapper method around a called array method that updates the assocation
resource if the array has changed.
Create a wrapper method around a called array method that updates the assocation resource if the array has changed .
# update the association if the array has changed
method_name
<not_specific>