module Trailblazer::Finder::Helpers::Basic
Public Instance Methods
count()
click to toggle source
# File lib/trailblazer/finder/helpers/basic.rb, line 36 def count return if @errors.any? @count ||= result.size end
filters()
click to toggle source
# File lib/trailblazer/finder/helpers/basic.rb, line 22 def filters @filters ||= @find.filters if @errors.empty? end
paging()
click to toggle source
# File lib/trailblazer/finder/helpers/basic.rb, line 7 def paging return if @errors.any? return if @find.paging.empty? result = Utils::Hash.remove_keys_from_hash(@find.paging, %i[handler max_per_page min_per_page]) result[:page] = result[:page] || result.delete(:current_page) || result[:current_page] result end
params()
click to toggle source
# File lib/trailblazer/finder/helpers/basic.rb, line 16 def params return @options[:params] if @errors.any? @params ||= (paging.merge @find.params).merge sort: sorting end
result()
click to toggle source
# File lib/trailblazer/finder/helpers/basic.rb, line 26 def result @result ||= @errors.empty? ? fetch_result : {errors: @errors} if respond_to?(:fetch_result) end
result?()
click to toggle source
# File lib/trailblazer/finder/helpers/basic.rb, line 30 def result? return false if @errors.any? result.any? end