Module: TaliaCore::DataTypes::FileStore::ClassMethods
- Included in:
- TaliaCore::DataTypes::FileRecord
- Defined in:
- lib/talia_core/data_types/file_store.rb
Instance Method Summary collapse
-
#find_or_create_and_assign_file(params) ⇒ Object
Find or create a record for the given location and source_id, then it saves the given file.
Instance Method Details
#find_or_create_and_assign_file(params) ⇒ Object
Find or create a record for the given location and source_id, then it saves the given file.
18 19 20 21 22 |
# File 'lib/talia_core/data_types/file_store.rb', line 18 def find_or_create_and_assign_file(params) data_record = self.find_or_create_by_location_and_source_id(extract_filename(params[:file]), params[:source_id]) data_record.file = params[:file] data_record.save # force attachment save and it also saves type attribute. end |