spec/dummy/app/models/library.rb in importable_attachments-0.0.13 vs spec/dummy/app/models/library.rb in importable_attachments-0.0.14
- old
+ new
@@ -1,7 +1,5 @@
-require 'importable_attachments/importers'
-
class Library < ActiveRecord::Base
include SmarterDates if ::Configuration.for('smarter_dates').enabled
if ::Configuration.for('versioning').enabled
has_paper_trail ignore: [:updated_at]
@@ -11,12 +9,10 @@
if ::Configuration.for('attachments').enabled
extend ImportableAttachments::Base::ClassMethods
has_importable_attachment spreadsheet_columns: RECORD_HEADERS,
import_into: :books
- include ImportableAttachments::Importers::Csv
- validates_with ImportableAttachments::CsvValidator, if: Proc.new { |model| model.attachment.present? && model.attachment.persisted? }
end
# --------------------------------------------------------------------------
# define: attributes and relationships
has_many :books, dependent: :destroy, inverse_of: :library
@@ -32,19 +28,9 @@
# define: scopes
attr_accessible :name, :address
# --------------------------------------------------------------------------
# define: behaviors
-
- # : call-seq:
- # import_attachment
- #
- # imports an attachment of a given mime-type (data-stream to ruby),
- # calls import_rows with a ruby data-store
-
- def import_attachment
- import_csv
- end
protected
def sanitize_data_callback(headers, sheet) # :nodoc:
new_sheet = sheet.map {|row| row + [id]}