Module: Toolbox::Helpers

Defined in:
lib/toolbox/helpers.rb

Class Method Summary collapse

Class Method Details

.collection_attribute_name(collection_config, rec) ⇒ Object



5
6
7
8
# File 'lib/toolbox/helpers.rb', line 5

def self.collection_attribute_name collection_config, rec
  new_or_existing = rec && !rec.new_record? ? 'existing' : 'new'
  "#{new_or_existing}_#{collection_config.type.name.to_s.underscore}_attributes"
end