Module: DataMapper::ExtJS::Collection

Included in:
Collection
Defined in:
lib/dm-extjs/collection.rb

Instance Method Summary collapse

Instance Method Details

#to_extjs(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/dm-extjs/collection.rb', line 5

def to_extjs (options={})
  ret = {
    :metaData => model.ext_meta(options[:methods]),
    :success => options.has_key?(:success) ? options[:success] : true,
    :message => options.has_key?(:message) ? options[:message] : '',
    :total => count,
    :results => self.to_json(options.merge(:to_json => false))
  }
  options.fetch(:to_json, true) ? ret.to_json : ret
end