Class: Alchemy::Ingredients::Boolean

Inherits:
Alchemy::Ingredient show all
Defined in:
app/models/alchemy/ingredients/boolean.rb

Overview

A boolean value

Instance Method Summary collapse

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

#has_hint?, #hint

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

#valueObject



8
9
10
# File 'app/models/alchemy/ingredients/boolean.rb', line 8

def value
  ActiveRecord::Type::Boolean.new.cast(self[:value])
end