lib/onoma/item.rb in onoma-0.2.0 vs lib/onoma/item.rb in onoma-0.2.1
- old
+ new
@@ -9,10 +9,12 @@
def initialize(nomenclature, name, options = {})
@nomenclature = nomenclature
@name = name.to_s
@left, @right = @nomenclature.new_boundaries
@depth = 0
+ @parent = nil
+ @parent_name = nil
parent = options.delete(:parent)
if parent.is_a?(Symbol) || parent.is_a?(String)
@parent_name = parent.to_s
else
self.parent = parent
@@ -174,10 +176,10 @@
self >= other
end
# Return human name of item
def human_name(options = {})
- "nomenclatures.#{nomenclature.name}.items.#{name}".t(options.merge(default: ["items.#{name}".to_sym, "enumerize.#{nomenclature.name}.#{name}".to_sym, "labels.#{name}".to_sym, name.humanize]))
+ I18n.translate("nomenclatures.#{nomenclature.name}.items.#{name}", options.merge(default: ["items.#{name}".to_sym, "enumerize.#{nomenclature.name}.#{name}".to_sym, "labels.#{name}".to_sym, name.humanize]))
end
alias humanize human_name
alias localize human_name
alias l localize