Skip to content

Commit

Permalink
Added some robustness to assets and the ISO migration
Browse files Browse the repository at this point in the history
  • Loading branch information
janv committed Dec 2, 2009
1 parent e1b4ba1 commit 9307a9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/asset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Asset < ActiveRecord::Base
:styles => lambda { |attachment|
returning(HashWithIndifferentAccess.new) do |styles|
styles.merge!(attachment.instance.vrame_styles) if attachment.instance.vrame_styles.is_a? Hash
styles.merge!(Vrame.configuration.posterframe_styles)
styles.merge!(Vrame.configuration.posterframe_styles) if Vrame.configuration.posterframe_styles.is_a? Hash
styles.merge!(Asset::DEFAULT_STYLES)
end
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Image < Asset
:styles => lambda { |attachment|
returning(HashWithIndifferentAccess.new) do |styles|
styles.merge!(attachment.instance.vrame_styles) if attachment.instance.vrame_styles.is_a? Hash
styles.merge!(Vrame.configuration.image_styles)
styles.merge!(Vrame.configuration.image_styles) if Vrame.configuration.image_styles.is_a? Hash
styles.merge!(Asset::DEFAULT_STYLES)
end
},
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20091111165203_change_iso3_to_iso2_in_languages.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
class ChangeIso3ToIso2InLanguages < ActiveRecord::Migration
MAP = {'deu' => 'de', 'eng' => 'en'}
def self.up
rename_column :languages, :iso3_code, :iso2_code
Language.reset_column_information
Language.find_each {|l| l.update_attribute(:iso2_code, MAP[l.iso2_code]) }
end

def self.down
rename_column :albums, :iso2_code, :iso3_code
Language.reset_column_information
Language.find_each {|l| l.update_attribute(:iso2_code, MAP.invert[l.iso2_code]) }
end
end

0 comments on commit 9307a9e

Please sign in to comment.