Class: Components::Base
- Inherits:
-
Object
- Object
- Components::Base
- Includes:
- ActionController::Helpers, ActionController::UrlWriter, Caching
- Defined in:
- lib/components/base.rb
Class Attribute Summary collapse
-
.template ⇒ Object
Returns the value of attribute template.
Instance Attribute Summary collapse
-
#_request ⇒ Object
for request forgery protection compatibility.
-
#form_authenticity_token ⇒ Object
for request forgery protection compatibility.
Class Method Summary collapse
-
.path ⇒ Object
(also: controller_path)
:nodoc:.
-
.view_paths ⇒ Object
The view paths to search for templates.
Instance Method Summary collapse
-
#logger ⇒ Object
must be public for access from ActionView.
-
#protect_against_forgery? ⇒ Boolean
:nodoc:.
Methods included from Caching
Class Attribute Details
.template ⇒ Object
Returns the value of attribute template.
32 33 34 |
# File 'lib/components/base.rb', line 32 def template @template end |
Instance Attribute Details
#_request ⇒ Object
for request forgery protection compatibility
8 9 10 |
# File 'lib/components/base.rb', line 8 def _request @_request end |
#form_authenticity_token ⇒ Object
for request forgery protection compatibility
8 9 10 |
# File 'lib/components/base.rb', line 8 def form_authenticity_token @form_authenticity_token end |
Class Method Details
.path ⇒ Object Also known as: controller_path
:nodoc:
27 28 29 |
# File 'lib/components/base.rb', line 27 def path #:nodoc: @path ||= self.to_s.sub("Component", "").underscore end |
.view_paths ⇒ Object
The view paths to search for templates. Typically this will only be “app/components”, but if you have a plugin that uses Components, it may add its own directory (e.g. “vendor/plugins/scaffolding/components/” to this array.
19 20 21 22 23 24 25 |
# File 'lib/components/base.rb', line 19 def view_paths if read_inheritable_attribute(:view_paths).nil? default_path = File.join(RAILS_ROOT, 'app', 'components') write_inheritable_attribute(:view_paths, [default_path]) end read_inheritable_attribute(:view_paths) end |
Instance Method Details
#logger ⇒ Object
must be public for access from ActionView
36 37 38 |
# File 'lib/components/base.rb', line 36 def logger #:nodoc: RAILS_DEFAULT_LOGGER end |
#protect_against_forgery? ⇒ Boolean
:nodoc:
11 12 13 |
# File 'lib/components/base.rb', line 11 def protect_against_forgery? #:nodoc: allow_forgery_protection && request_forgery_protection_token end |