lib/locomotive/steam/models/i18n_field.rb in locomotivecms_steam-1.1.0.rc3 vs lib/locomotive/steam/models/i18n_field.rb in locomotivecms_steam-1.1.0
- old
+ new
@@ -3,11 +3,11 @@
class I18nField
extend Forwardable
- def_delegators :@translations, :values, :blank?, :default
+ def_delegators :@translations, :values, :default
attr_reader :name, :translations
def initialize(name, translations)
@name = name
@@ -35,9 +35,13 @@
end).with_indifferent_access
end
def each(&block)
@translations.each(&block)
+ end
+
+ def blank?
+ @translations.blank? && @translations[:anything].blank?
end
def apply(&block)
if default
@translations = Hash.new(yield(default))