6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/controller_setter_pattern/action_controller.rb', line 6
def set(*names)
callback_options = names.
(options ||= {})[:model] = callback_options.delete(:model)
options[:model] ||= options[:model].to_s.camelize.constantize unless options[:model].nil?
options[:finder_params] = _normalize_finder_params(callback_options.delete(:finder_params) || [])
options[:finder_method] = 'find' + (options[:finder_params].empty? ? '' : '_by_' + options[:finder_params].join('_and_'))
options[:ancestor] = callback_options.delete(:ancestor)
options[:scope] = callback_options.delete(:scope)
_insert_setters(names, options, callback_options)
end
|