Class: Jets::Router::Resources::Options

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/router/resources/options.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Jets::Router::Resources::Base

Instance Method Details

#build(action) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/jets/router/resources/options.rb', line 3

def build(action)
  controller = @options[:singular_resource] ? @name.to_s.pluralize : @name
  options = @options.merge(to: "#{controller}##{action}") # important to create a copy of the options
  # remove special options from getting to create_route. For some reason .slice! doesnt work
  options.delete(:only)
  options.delete(:except)
  options[:from_scope] = true # flag to drop the prefix later in Route#compute_path
  options
end