app/controllers/upmin/models_controller.rb in upmin-admin-0.0.37 vs app/controllers/upmin/models_controller.rb in upmin-admin-0.0.38

- old
+ new

@@ -25,11 +25,11 @@ updates.each do |key, value| # TODO(jon): Figure out a better way to do transforms. # This could cause issues and is exploitable, but it # should be fine for now since this is only on admin pages - if transforms[key] + if transforms[key] and not value.blank? value = transform(transforms, key, value) end instance.send("#{key}=", value) end @@ -43,11 +43,11 @@ end end def search @q = @klass.ransack(params[:q]) - @results = @q.result(distinct: true).page(@page).per(30) + @results = Upmin::Paginator.paginate(@q.result(distinct: true), @page, 30) end def action # begin response = @model.perform_action(params[:method], @arguments) @@ -78,10 +78,10 @@ arguments = params[@method] || {} @arguments = arguments.select{|k, v| !v.empty? } end def set_page - @page = params[:page] || 0 + @page = params[:page] || 1 end # TODO(jon): Figure out a better way to do transforms that is easy to extend. def transform(transforms, key, value) split = transforms[key].split('#')