MongoDB config & TrackData model
This commit is contained in:
@@ -2,11 +2,11 @@ class Track < ActiveRecord::Base
|
||||
set_table_name 'musicbrainz.bh_track'
|
||||
belongs_to :release
|
||||
|
||||
def convertLength
|
||||
(length /= 1000).round!
|
||||
end
|
||||
|
||||
def clearName
|
||||
name.gsub('&', 'and').gsub(/[^a-z0-9]/, '').downcase
|
||||
end
|
||||
|
||||
def files
|
||||
TrackData(:id => id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class TrackData
|
||||
include Mongoid::Document
|
||||
store_in :track_data
|
||||
|
||||
key :id, Integer
|
||||
key :artist, String
|
||||
key :title, String
|
||||
key :length, Integer
|
||||
key :files, Array
|
||||
end
|
||||
Reference in New Issue
Block a user