Class: Components::Base

Inherits:
Object
  • Object
show all
Includes:
ActionController::Helpers, ActionController::UrlWriter, Caching
Defined in:
lib/components/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Caching

included

Instance Attribute Details

#form_authenticity_tokenObject

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

.pathObject 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_pathsObject

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

#loggerObject

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:

Returns:

  • (Boolean)


10
11
12
# File 'lib/components/base.rb', line 10

def protect_against_forgery? #:nodoc:
  allow_forgery_protection && request_forgery_protection_token
end