lib/config_scripts/seeds/seed_type.rb
# This method writes the seed data file to a folder.
#
# This will write a header row with the names of the attributes, and then
# write a row for each item from the {#items} method. It will use the
# {#write_value_for_attribute} method to get the values for the CSV file.
#
# If this seed type has no attributes, this method will not write
# anything.
#
# @param [String] folder
#   The full path to the folder to write to.
This method writes the seed data file to a folder.
This will write a header row with the names of the attributes, and then
write a row for each item from the {#items} method. It will use the
{#write_value_for_attribute} method to get the values for the CSV file.

If this seed type has no attributes, this method will not write
anything.
This method writes the seed data file to a folder . This will write a header row with the names of the attributes and then write a row for each item from the { #items } method . It will use the { #write_value_for_attribute } method to get the values for the CSV file . If this seed type has no attributes this method will not write anything .
def write_to_folder(folder)
        return unless attributes.any?
        CSV.open(File.join(folder, "#{self.filename}.csv"), 'w') do |csv|
          csv << self.attributes
          self.items.each do |item|
            data = self.attributes.collect { |attribute| self.write_value_for_attribute(item, attribute) }
            csv << data
          end
        end
      end
def write_to_folder ( folder ) return unless attributes . any? CSV . open ( File . join ( folder , "#{self.filename}.csv" ) , 'w' ) do | csv | csv << self . attributes self . items . each do | item | data = self . attributes . collect { | attribute | self . write_value_for_attribute ( item , attribute ) } csv << data end end end
This method writes the seed data file to a folder.
This method writes the seed data file to a folder .
folder
<not_specific>
<not_specific>
folder The full path to the folder to write to.
folder The full path to the folder to write to .