Module: Nester::Helper::ClassMethods

Defined in:
lib/nester.rb

Instance Method Summary collapse

Instance Method Details

#nest(model, options = {}) ⇒ Object



88
89
90
91
92
93
94
95
96
97
# File 'lib/nester.rb', line 88

def nest(model, options = {})
  options[:under] = [*options[:under]]   # convert item to single item array
  options[:namespace] = [*options[:namespace]]
  options[:model] = model

  options[:singular_name] = options[:model].to_s
  options[:plural_name] = options[:singular_name].pluralize

  build_named_route_methods(options)
end