Module: Ransack::Helpers::FormHelper

Defined in:
lib/tolaria/ransack.rb

Defined Under Namespace

Classes: SortLink

Instance Method Summary collapse

Instance Method Details



8
9
10
11
12
13
14
15
16
# File 'lib/tolaria/ransack.rb', line 8

def sort_link(search_object, attribute, *args, &block)
  search, routing_proxy = extract_search_and_routing_proxy(search_object)
  unless Search === search
    raise TypeError, 'First argument must be a Ransack::Search!'
  end
  args.unshift(capture(&block)) if block_given?
  s = SortLink.new(search, attribute, args, params, &block)
  link_to(s.name, url(routing_proxy, s.url_options), s.html_options(args))
end