Class: DescribedRoutes::RailsRoutes::RailsResourceTemplates
- Inherits:
-
ResourceTemplate::ResourceTemplates
- Object
- Array
- ResourceTemplate::ResourceTemplates
- DescribedRoutes::RailsRoutes::RailsResourceTemplates
- Defined in:
- lib/described_routes/rails_routes.rb
Overview
This is just glue really. It captures some extra data in the top level ResourceTemplates container to help address a couple of issues: 1) Inconsistent id parameter naming - id become foo_id when foo becomes the parent of another type of resources 2) Rails doesn’t pass in the route object (not even its name) when routing a request to a controller so we have to keep enough information here for us to be able to guess it. Controller and action will be enough 99% of the time.
Instance Attribute Summary collapse
-
#routing ⇒ Object
readonly
Maps [controller, action] to [resource_template, id_name].
Instance Method Summary collapse
-
#initialize(parsed) ⇒ RailsResourceTemplates
constructor
A new instance of RailsResourceTemplates.
Methods inherited from ResourceTemplate::ResourceTemplates
#all_by_name, #all_postorder, #all_preorder, #expand_links, parse_xml, #partial_expand, #to_json, #to_parsed, #to_table, #to_text, #to_xml, #to_yaml
Constructor Details
#initialize(parsed) ⇒ RailsResourceTemplates
Returns a new instance of RailsResourceTemplates.
15 16 17 18 19 20 |
# File 'lib/described_routes/rails_routes.rb', line 15 def initialize(parsed) super @routing = {} save_routing(parsed) end |
Instance Attribute Details
#routing ⇒ Object (readonly)
Maps [controller, action] to [resource_template, id_name]
13 14 15 |
# File 'lib/described_routes/rails_routes.rb', line 13 def routing @routing end |