Class: Components::Base
- Inherits:
-
Object
- Object
- Components::Base
- Includes:
- ActionController::Helpers, ActionController::UrlWriter, Caching
- Defined in:
- lib/components/base.rb
Instance Attribute Summary collapse
-
#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
Instance Attribute Details
#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:
26 27 28 |
# File 'lib/components/base.rb', line 26 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.
18 19 20 21 22 23 24 |
# File 'lib/components/base.rb', line 18 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
33 34 35 |
# File 'lib/components/base.rb', line 33 def logger #:nodoc: RAILS_DEFAULT_LOGGER end |
#protect_against_forgery? ⇒ Boolean
:nodoc:
10 11 12 |
# File 'lib/components/base.rb', line 10 def protect_against_forgery? #:nodoc: allow_forgery_protection && request_forgery_protection_token end |