Sha256: f82b8940f7b811323918cd01bdc08a484068f088a109967fee7a766ab8cbe41e
Contents?: true
Size: 626 Bytes
Versions: 8
Compression:
Stored size: 626 Bytes
Contents
module JsonapiCompliable module Scope::Filterable def find_filter(name) find_filter!(name) rescue JsonapiCompliable::Errors::BadFilter nil end def find_filter!(name) filter_name, filter_value = \ dsl.filters.find { |_name, opts| opts[:aliases].include?(name.to_sym) } raise JsonapiCompliable::Errors::BadFilter unless filter_name if guard = filter_value[:if] raise JsonapiCompliable::Errors::BadFilter if controller.send(guard) == false end { filter_name => filter_value } end def filter_param params[:filter] || {} end end end
Version data entries
8 entries across 8 versions & 1 rubygems