Method: Jets::Router::Dsl#scope_options!

Defined in:
lib/jets/router/dsl.rb

#scope_options!(item, options) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/jets/router/dsl.rb', line 53

def scope_options!(item, options)
  prefix = if options[:prefix]
    # prefix given from the resources macro get automatically prepended to the item name
    p = options.delete(:prefix)
    "#{p}/#{item}"
  else
    item
  end

  {
    as: options.delete(:as) || item, # delete as or it messes with create_route
    prefix: prefix,
    param: options[:param],
    # module: options.delete(:module) || item, # NOTE: resources does not automatically set module, but namespace does
  }
end