Class: Trust::Controller::Resource::Info
- Inherits:
-
Object
- Object
- Trust::Controller::Resource::Info
- Defined in:
- lib/trust/controller/resource.rb
Overview
ResorceInfo
resolves information about the resource accessed in action controller
Examples in PeopleController (simple case)
resource.info.klass => Person
resource.info.params => {:person => {...}} # fetches the parameters for the resource
resource.info.name => :person
resource.info.plural_name => :people
resource.info.path => 'people' # this is the controller_path
Examples in Lottery::AssignmentsController (with name space)
resource.info.klass => Lottery::Assignment
resource.info.params => {:lottery_assignment => {...}}
resource.info.name => :lottery_assignment
resource.info.plural_name => :lottery_assignments
resource.info.path => 'lottery/assignments' # this is the controller_path
Examples in ArchiveController (with inheritance)
Assumptions on routes:
resources :archives
resources :secret_acrvives, :controller => :archives
resources :public_acrvives, :controller => :archives
Examples below assumes that the route secret_arcives is being accessed at the moment
resource.info.klass => Archive
resource.info.params => {:secret_archive => {...}}
resource.info.name => :archive
resource.info.plural_name => :archives
resource.info.path => 'archive' # this is the controller_path
resource.info.real_class => SecretArchive # Returns the real class which is accessed at the moment
Direct Known Subclasses
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
:nodoc:.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#real_class ⇒ Object
readonly
Returns the value of attribute real_class.
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
299 300 301 |
# File 'lib/trust/controller/resource.rb', line 299 def klass @klass end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
299 300 301 |
# File 'lib/trust/controller/resource.rb', line 299 def name @name end |
#params ⇒ Object (readonly)
:nodoc:
301 302 303 |
# File 'lib/trust/controller/resource.rb', line 301 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
299 300 301 |
# File 'lib/trust/controller/resource.rb', line 299 def path @path end |
#real_class ⇒ Object (readonly)
Returns the value of attribute real_class.
299 300 301 |
# File 'lib/trust/controller/resource.rb', line 299 def real_class @real_class end |