Method: CaRuby::Persistable#remove_lazy_loader

Defined in:
lib/caruby/database/persistable.rb

#remove_lazy_loader(attribute = nil) ⇒ Object

Disables lazy loading of the specified attribute. Lazy loaded is disabled for all attributes if no attribute is specified. This method is a no-op if this Persistable does not have a lazy loader.

Parameters:

  • the (Symbol)

    attribute to remove from the load list, or nil if to remove all attributes



225
226
227
228
229
230
231
232
233
234
235
# File 'lib/caruby/database/persistable.rb', line 225

def remove_lazy_loader(attribute=nil)
  if attribute.nil? then
    return self.class.domain_attributes.each { |pa| remove_lazy_loader(pa) }
  end
  # the modified accessor method
  reader, writer = self.class.property(attribute).accessors
  # remove the reader override
  disable_singleton_method(reader)
  # remove the writer override
  disable_singleton_method(writer)
end