Class: ActionController::Resources::Resource
- Defined in:
- lib/action_controller/resources.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#collection_methods ⇒ Object
readonly
Returns the value of attribute collection_methods.
-
#member_methods ⇒ Object
readonly
Returns the value of attribute member_methods.
-
#name_prefix ⇒ Object
readonly
Returns the value of attribute name_prefix.
-
#new_methods ⇒ Object
readonly
Returns the value of attribute new_methods.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path_prefix ⇒ Object
readonly
Returns the value of attribute path_prefix.
-
#plural ⇒ Object
readonly
Returns the value of attribute plural.
-
#singular ⇒ Object
readonly
Returns the value of attribute singular.
Instance Method Summary collapse
- #controller ⇒ Object
-
#initialize(entities, options) ⇒ Resource
constructor
A new instance of Resource.
- #member_path ⇒ Object
- #nesting_path_prefix ⇒ Object
- #new_path ⇒ Object
- #path ⇒ Object
Constructor Details
#initialize(entities, options) ⇒ Resource
Returns a new instance of Resource.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/action_controller/resources.rb', line 9 def initialize(entities, ) @plural = entities @singular = [:singular] || plural.to_s.singularize @options = arrange_actions add_default_actions set_prefixes end |
Instance Attribute Details
#collection_methods ⇒ Object (readonly)
Returns the value of attribute collection_methods.
4 5 6 |
# File 'lib/action_controller/resources.rb', line 4 def collection_methods @collection_methods end |
#member_methods ⇒ Object (readonly)
Returns the value of attribute member_methods.
4 5 6 |
# File 'lib/action_controller/resources.rb', line 4 def member_methods @member_methods end |
#name_prefix ⇒ Object (readonly)
Returns the value of attribute name_prefix.
5 6 7 |
# File 'lib/action_controller/resources.rb', line 5 def name_prefix @name_prefix end |
#new_methods ⇒ Object (readonly)
Returns the value of attribute new_methods.
4 5 6 |
# File 'lib/action_controller/resources.rb', line 4 def new_methods @new_methods end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/action_controller/resources.rb', line 7 def @options end |
#path_prefix ⇒ Object (readonly)
Returns the value of attribute path_prefix.
5 6 7 |
# File 'lib/action_controller/resources.rb', line 5 def path_prefix @path_prefix end |
#plural ⇒ Object (readonly)
Returns the value of attribute plural.
6 7 8 |
# File 'lib/action_controller/resources.rb', line 6 def plural @plural end |
#singular ⇒ Object (readonly)
Returns the value of attribute singular.
6 7 8 |
# File 'lib/action_controller/resources.rb', line 6 def singular @singular end |
Instance Method Details
#controller ⇒ Object
20 21 22 |
# File 'lib/action_controller/resources.rb', line 20 def controller ([:controller] || plural).to_s end |
#member_path ⇒ Object
32 33 34 |
# File 'lib/action_controller/resources.rb', line 32 def member_path "#{path}/:id" end |
#nesting_path_prefix ⇒ Object
36 37 38 |
# File 'lib/action_controller/resources.rb', line 36 def nesting_path_prefix "#{path}/:#{singular}_id" end |
#new_path ⇒ Object
28 29 30 |
# File 'lib/action_controller/resources.rb', line 28 def new_path "#{path}/new" end |
#path ⇒ Object
24 25 26 |
# File 'lib/action_controller/resources.rb', line 24 def path "#{path_prefix}/#{plural}" end |