1
0
Fork 0

Album has_pic fix, production gems fix

This commit is contained in:
magnolia-fan 2011-06-30 09:29:24 +04:00
parent 13a233ac72
commit 31a1cb88e2
5 changed files with 19 additions and 7 deletions

11
Gemfile
View File

@ -3,11 +3,6 @@ source 'http://rubygems.org'
gem 'rails', '3.0.9'
gem 'json'
gem 'sass'
gem 'coffee-script'
gem 'therubyracer', :require => false
gem 'barista'
gem 'awesome_print', :require => 'ap'
gem 'delayed_job'
@ -16,6 +11,12 @@ gem 'musicbrainz-ruby', :git => 'git://github.com/magnolia-fan/musicbrainz-ruby.
group :development do
gem 'sqlite3'
gem 'sass'
gem 'coffee-script'
gem 'therubyracer', :require => false
gem 'barista'
end
group :production do

View File

@ -121,6 +121,7 @@ class ImportController < ApplicationController
album.mbid = mb_album['id']
album.album_type = mb_album['type']
album.pic_url = album_image
album.has_pic = (album_image != '' and not album_image.nil?)
album.save unless dry_run
ap album if dry_run

View File

@ -1,3 +1,3 @@
class Artist < ActiveRecord::Base
has_many :albums, :order => '(pic_url!="" AND pic_url IS NOT NULL) DESC, year ASC, id ASC', :dependent => :destroy
has_many :albums, :order => 'has_pic DESC, year ASC, id ASC', :dependent => :destroy
end

View File

@ -0,0 +1,9 @@
class AddHasPicToAlbum < ActiveRecord::Migration
def self.up
add_column :albums, :has_pic, :integer
end
def self.down
remove_column :albums, :has_pic
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110630035132) do
ActiveRecord::Schema.define(:version => 20110630052149) do
create_table "albums", :force => true do |t|
t.string "name"
@ -21,6 +21,7 @@ ActiveRecord::Schema.define(:version => 20110630035132) do
t.datetime "updated_at"
t.string "album_type"
t.string "mbid"
t.integer "has_pic"
end
create_table "artists", :force => true do |t|