GavinJoyce / restpack-resource

RESTful side-loading, paging, filtering and sorting
MIT License
0 stars 0 forks source link

Filter paged_resource params based on whitelist #2

Closed GavinJoyce closed 11 years ago

GavinJoyce commented 11 years ago

Valid parameters will be page, includes, allowed filter keys, allowed sort keys, sort direction

GavinJoyce commented 11 years ago

We already have a whitelist:

options = overrides.reverse_merge( #overrides take precedence over params
  :page => params[:page],
  :includes => params[:includes].nil? ? [] : params[:includes].split(','),
  :filters =>  self.extract_filters_from_params(params),
  :sort_by => params[:sort_by], 
  :sort_direction => params[:sort_direction]
)