Module: ActsAsFlexigrid::ClassMethods

Defined in:
lib/acts_as_flexigrid.rb

Instance Method Summary collapse

Instance Method Details

#flexigrid(params, options = {}, &block) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/acts_as_flexigrid.rb', line 36

def flexigrid(params, options = {}, &block)
  rows = flexigrid_scope(params).map do |site|
    cell = site.attributes.merge(options)
    cell.merge!(yield(site)) if block_given?
    { :id => site.id, :cell => cell }
  end
  { :rows => rows, :total => self.flexigrid_where(params['qtype'], params['query']).count, :page => params["page"] }
end