103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/ext/controllers/paginate.rb', line 103
def parse(*args)
options = args.optionize(:model, :limit)
options[:ds_class] ||= Ext::Data::ActiveStore
options[:cm_class] ||= Ext::Grid::ActiveRecord
options[:grid_class] ||= options[:edit] ? Ext::Grid::EditorGrid : Ext::Grid::Grid
options[:limit] = [options[:limit].to_i, 10].max
options[:model] =
case (model = options[:model])
when Class then model
when String, Symbol then model.to_s.classify.constantize
else raise ArgumentError, "ext_paginate needs a class but got `#{model.class}'"
end
options[:select] =
case (select = options[:select])
when NilClass then "*"
when Array then select.join(', ')
else select.to_s
end
return options
end
|