Module: Card::Set::All::Name::ClassMethods
- Defined in:
- tmpsets/set/mod001-01_core/all/name.rb
Instance Method Summary collapse
Instance Method Details
#uniquify_name(name, rename = :new) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'tmpsets/set/mod001-01_core/all/name.rb', line 7 def uniquify_name name, rename=:new return name unless Card.exists?(name) uniq_name = "#{name} 1" while Card.exists?(uniq_name) uniq_name.next! end if rename == :old # name conflict resolved; original name can be used Card[name].update_attributes! name: uniq_name, update_referencers: true name else uniq_name end end |