1
0
Fork 0

MongoDB config & TrackData model

This commit is contained in:
magnolia-fan 2011-04-07 06:50:02 +04:00
parent a9b4a46c59
commit 3c96c151bd
8 changed files with 72 additions and 18879 deletions

View File

@ -6,6 +6,9 @@ gem 'rails', '3.0.5'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'mongo', '1.3.0'
gem 'bson_ext', '1.3.0'
gem 'mongoid', '~> 2.0'
# Use unicorn as the web server
# gem 'unicorn'

View File

@ -29,6 +29,8 @@ GEM
activesupport (= 3.0.5)
activesupport (3.0.5)
arel (2.0.9)
bson (1.3.0)
bson_ext (1.3.0)
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
@ -39,6 +41,13 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mongo (1.3.0)
bson (>= 1.3.0)
mongoid (2.0.1)
activemodel (~> 3.0)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
will_paginate (~> 3.0.pre)
pg (0.10.1)
polyglot (0.3.1)
rack (1.2.2)
@ -64,10 +73,14 @@ GEM
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.26)
will_paginate (3.0.pre2)
PLATFORMS
ruby
DEPENDENCIES
bson_ext (= 1.3.0)
mongo (= 1.3.0)
mongoid (~> 2.0)
pg
rails (= 3.0.5)

View File

@ -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

View File

@ -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

23
rails/config/mongoid.yml Normal file
View File

@ -0,0 +1,23 @@
defaults: &defaults
host: localhost
# slaves:
# - host: slave1.local
# port: 27018
# - host: slave2.local
# port: 27019
development:
<<: *defaults
database: beathaven
test:
<<: *defaults
database: beathaven_test
# set these environment variables on your prod server
production:
host: <%= ENV['MONGOID_HOST'] %>
port: <%= ENV['MONGOID_PORT'] %>
username: <%= ENV['MONGOID_USERNAME'] %>
password: <%= ENV['MONGOID_PASSWORD'] %>
database: <%= ENV['MONGOID_DATABASE'] %>

File diff suppressed because it is too large Load Diff

11
rails/test/fixtures/track_data.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

View File

@ -0,0 +1,8 @@
require 'test_helper'
class TrackDataTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end