Sha256: 6aea38d2026eea67105ee255dea13e9b932ca1243055cd5a443308b02be7822a
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
class FaqImport < ScaffoldLogic::DataImport # Class Methods ================================================================================== def self.test( path='public/faqs.xls' ) self.run path end # Instance Methods =============================================================================== def process_row if faq = Publication.first.managed_contents.where(:slug => row_map[:slug].downcase).first || Publication.first.managed_contents.new(:slug => row_map[:slug].downcase) COLUMNS_BY_MODEL_FIELDS.keys.each do |_field| _content = eval(COLUMNS_BY_MODEL_FIELDS[_field]) faq.send("#{_field}=", _content) unless _content.blank? end faq.headline ||= faq.subheader faq.save @errors = faq.errors end @errors end protected COLUMNS_BY_MODEL_FIELDS = { 'desired_slug' => 'row_map[:slug]', 'title' => 'row_map[:title]', 'summary' => 'row_map[:summary]', 'keywords' => 'row_map[:keywords]', 'subheader' => 'row_map[:subheader]', 'breadcrumbs' => 'row_map[:breadcrumbs]', 'content' => 'row_map[:content]' } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
editorial_logic-1.1.0 | app/models/faq_import.rb |