Class: Adminable::Attributes::Base
- Inherits:
-
Object
- Object
- Adminable::Attributes::Base
- Defined in:
- lib/adminable/attributes/base.rb
Overview
Cannot be initialized
Base class for attributes types
Direct Known Subclasses
Types::BelongsTo, Types::Boolean, Types::Date, Types::Datetime, Types::Decimal, Types::Float, Types::HasMany, Types::Integer, Types::String, Types::Text, Types::Time, Types::Timestamp
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
Returns the value of attribute association.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#strong_parameter ⇒ Object
readonly
Returns the value of attribute strong_parameter.
Instance Method Summary collapse
- #form_partial_path ⇒ Object
- #index_partial_path ⇒ Object
-
#initialize(name, options = {}) ⇒ Base
constructor
A new instance of Base.
- #ransack_name ⇒ Object
-
#type ⇒ Symbol
Class type e.g.
Constructor Details
#initialize(name, options = {}) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/adminable/attributes/base.rb', line 10 def initialize(name, = {}) raise 'Base class cannot be initialized' if self.class == Base @name = name.to_sym @options = .merge() @association = Adminable::Attributes::Association.new( [:association] ) if [:association] end |
Instance Attribute Details
#association ⇒ Object (readonly)
Returns the value of attribute association.
6 7 8 |
# File 'lib/adminable/attributes/base.rb', line 6 def association @association end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/adminable/attributes/base.rb', line 6 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/adminable/attributes/base.rb', line 6 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/adminable/attributes/base.rb', line 6 def @options end |
#strong_parameter ⇒ Object (readonly)
Returns the value of attribute strong_parameter.
6 7 8 |
# File 'lib/adminable/attributes/base.rb', line 6 def strong_parameter @strong_parameter end |
Instance Method Details
#form_partial_path ⇒ Object
42 43 44 |
# File 'lib/adminable/attributes/base.rb', line 42 def form_partial_path "adminable/resources/form/#{type}" end |
#index_partial_path ⇒ Object
38 39 40 |
# File 'lib/adminable/attributes/base.rb', line 38 def index_partial_path "index/#{type}" end |
#ransack_name ⇒ Object
29 30 31 |
# File 'lib/adminable/attributes/base.rb', line 29 def ransack_name @ransack_name ||= "#{name}_cont" end |
#type ⇒ Symbol
Returns class type e.g. :text for Adminable::Attributes::Text.
34 35 36 |
# File 'lib/adminable/attributes/base.rb', line 34 def type @type ||= self.class.name.demodulize.underscore.to_sym end |