audio.rb

Path: app/models/audio.rb
Last Update: Fri Nov 23 12:07:29 +1100 2007

Throughout the program the Audio class is referred to as "Sounds". Sounds would probably be a better name for this class as it is simpler word which encapsulates the concept fine. Originally it was thought that this class could be subdivided into more classes if needed including song, story and message. At the moment all of these things have similar needs so it has not been required. If this became important this would probably be best solved with Single Table Inheritance.

Currently the ferret search does not return media files based on contributors or subjects, but it should. This could be done by creating some extra methods to return the lists of all those involved, and then indexing these methods.

People are contributors to an Audio file if they helped to create it (recordists etc.). Subjects are animals, places etc. that are mentioned in the Audio. The person who narrates or sings could be seen as both a conributor and a subject, it is probably worth working what the best practice for such things is.

Using the file_column plugin the files are currently stored in the filesystem in public/audio/url/ according to the default settings. file_column is no longer supported and it would be worth thinking about moving to acts_as_attachment which is easier to maintain and customize.

schema.rb snippet:

  create_table "audio", :force => true do |t|
    t.column "url",                  :string,   :null => false
    t.column "format",               :string
    t.column "type",                 :string
    t.column "description",          :text
    t.column "created_at",           :datetime
    t.column "updated_at",           :datetime
    t.column "recorded_on",          :date
    t.column "restriction",          :string
    t.column "original_format",      :string
    t.column "location_of_original", :string
    t.column "catalogue_ref",        :string
    t.column "copyright_notice_id",  :integer
  end

[Validate]