Module: ListFor::HelperMethods

Defined in:
lib/list_for/helper_methods.rb

Instance Method Summary collapse

Instance Method Details

#list_for(*args, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/list_for/helper_methods.rb', line 9

def list_for(*args, &block)
  options = args.extract_options! 
  
  options[:records] = args.first
  options[:template] = "list_for/list_for"
  options[:templates_folder] = "list_for"
  options[:record_variable] = "records"
  options[:variable] = "list"
  
  ListFor::Base.new(self, options, &block).render
end

#list_for_options(options = {}, parameters = {}) ⇒ Object



3
4
5
6
7
# File 'lib/list_for/helper_methods.rb', line 3

def list_for_options(options={}, parameters={})
  evaluated_options = {}
  options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call(parameters) : v)}
  evaluated_options
end