Class: Alchemy::Ingredients::Boolean
- Inherits:
-
Alchemy::Ingredient
- Object
- ActiveRecord::Base
- BaseRecord
- Alchemy::Ingredient
- Alchemy::Ingredients::Boolean
- Defined in:
- app/models/alchemy/ingredients/boolean.rb
Overview
A boolean value
Instance Method Summary collapse
-
#preview_text(_max_length = nil) ⇒ Object
The localized value.
- #value ⇒ Object
Methods inherited from Alchemy::Ingredient
#definition, #deprecated?, #essence, #has_hint?, #has_tinymce?, #has_validations?, normalize_type, #partial_name, #preview_ingredient?, related_object_alias, #settings, #settings_value, #to_partial_path, translated_label_for
Methods included from Hints
Instance Method Details
#preview_text(_max_length = nil) ⇒ Object
The localized value
Used by the Element#preview_text method.
16 17 18 |
# File 'app/models/alchemy/ingredients/boolean.rb', line 16 def preview_text(_max_length = nil) Alchemy.t(value, scope: "ingredient_values.boolean") end |
#value ⇒ Object
8 9 10 |
# File 'app/models/alchemy/ingredients/boolean.rb', line 8 def value ActiveRecord::Type::Boolean.new.cast(self[:value]) end |