lib/active_metadata/persistence/attachment.rb in active_metadata-0.7.9 vs lib/active_metadata/persistence/attachment.rb in active_metadata-0.8.0

- old
+ new

@@ -6,12 +6,12 @@ module InstanceMethods def save_attachment_for(field, file, starred=false, group=nil) attachment = ActiveMetadata::Attachment.create!( - :document_class => metadata_class, - :document_id => metadata_id, + :model_class => metadata_class, + :model_id => metadata_id, :label => field, :attach => file, :starred => !!starred, :created_by => current_user_id, :group => group) @@ -98,10 +98,10 @@ #Rails.cache.clear Rails.cache.write(attachments_cache_key(field), fetch_attachments_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes) end def fetch_attachments_for(field, starred=nil, order_by="updated_at DESC") - conditions = {:document_class => metadata_class, :document_id => metadata_id} + conditions = {:model_class => metadata_class, :model_id => metadata_id} conditions[:label] = field unless field.nil? conditions[:starred] = starred unless starred.nil? ActiveMetadata::Attachment.all(:conditions => conditions, :order => order_by) end