Module: Ext::Controllers::Paginate::InstanceMethods
- Defined in:
- lib/ext/controllers/paginate.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
18 19 20 21 |
# File 'lib/ext/controllers/paginate.rb', line 18 def index @opts = render :inline=>"<%= ext_include %><%= ext_paginate @opts %><%= ext_grid %>" end |
#list ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ext/controllers/paginate.rb', line 23 def list opts = { :select => [:select], :offset => [params[:start].to_i-1, 0].max, :limit => [params[:limit].to_i, [:limit]].max, :order => sorts.blank? ? nil : sorts.map{|i| "%s %s" % [i, params[:dir]]}.join(', '), } json = { "count" => count.to_s, "items" => search(opts).map{|item| data(item)}, }.to_json render :text=>json end |
#show ⇒ Object
37 38 39 40 |
# File 'lib/ext/controllers/paginate.rb', line 37 def show record = [:model].find(params[:id]) render :text=>data(record).to_json end |
#update ⇒ Object
42 43 44 45 46 47 |
# File 'lib/ext/controllers/paginate.rb', line 42 def update pkey = [:model].primary_key attributes = CGIMethods.parse_request_parameters(request.cgi.params) [:model].update(params[pkey], attributes) render :nothing=>true end |