fixed typo in column name w/ migration
This commit is contained in:
parent
aa18abf08e
commit
8ccb441395
2 changed files with 16 additions and 6 deletions
|
@ -5,7 +5,7 @@ class Avatar < ApplicationModel
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
add a avatar based on auto detection (email address)
|
add an avatar based on auto detection (email address)
|
||||||
|
|
||||||
Avatar.auto_detection(
|
Avatar.auto_detection(
|
||||||
:object => 'User',
|
:object => 'User',
|
||||||
|
@ -72,7 +72,7 @@ add a avatar
|
||||||
object_id = ObjectLookup.by_name( data[:object] )
|
object_id = ObjectLookup.by_name( data[:object] )
|
||||||
end
|
end
|
||||||
|
|
||||||
# add inital avatar
|
# add initial avatar
|
||||||
add_init_avatar(object_id, data[:o_id])
|
add_init_avatar(object_id, data[:o_id])
|
||||||
|
|
||||||
record = {
|
record = {
|
||||||
|
@ -80,7 +80,8 @@ add a avatar
|
||||||
:object_lookup_id => object_id,
|
:object_lookup_id => object_id,
|
||||||
:default => true,
|
:default => true,
|
||||||
:deletable => data[:deletable],
|
:deletable => data[:deletable],
|
||||||
:inital => false,
|
# @TODO Check how to fix typos in database fields inital -> initial
|
||||||
|
:initial => false,
|
||||||
:source => data[:source],
|
:source => data[:source],
|
||||||
:source_url => data[:url],
|
:source_url => data[:url],
|
||||||
:updated_by_id => data[:updated_by_id],
|
:updated_by_id => data[:updated_by_id],
|
||||||
|
@ -120,6 +121,7 @@ add a avatar
|
||||||
if !response.success?
|
if !response.success?
|
||||||
#puts "WARNING: Can't fetch '#{self.image_source}' (maybe no avatar available), http code: #{response.code.to_s}"
|
#puts "WARNING: Can't fetch '#{self.image_source}' (maybe no avatar available), http code: #{response.code.to_s}"
|
||||||
#raise "Can't fetch '#{self.image_source}', http code: #{response.code.to_s}"
|
#raise "Can't fetch '#{self.image_source}', http code: #{response.code.to_s}"
|
||||||
|
# @TODO remove comment and log instead
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
#puts "NOTICE: Fetch '#{self.image_source}', http code: #{response.code.to_s}"
|
#puts "NOTICE: Fetch '#{self.image_source}', http code: #{response.code.to_s}"
|
||||||
|
@ -273,9 +275,9 @@ return all avatars of an user
|
||||||
avatars = Avatar.where(
|
avatars = Avatar.where(
|
||||||
:object_lookup_id => object_id,
|
:object_lookup_id => object_id,
|
||||||
:o_id => o_id,
|
:o_id => o_id,
|
||||||
).order( 'inital DESC, deletable ASC, created_at ASC, id DESC' )
|
).order( 'initial DESC, deletable ASC, created_at ASC, id DESC' )
|
||||||
|
|
||||||
# add inital avatar
|
# add initial avatar
|
||||||
add_init_avatar(object_id, o_id)
|
add_init_avatar(object_id, o_id)
|
||||||
|
|
||||||
avatar_list = []
|
avatar_list = []
|
||||||
|
@ -358,7 +360,7 @@ returns:
|
||||||
:object_lookup_id => object_id,
|
:object_lookup_id => object_id,
|
||||||
:default => true,
|
:default => true,
|
||||||
:source => 'init',
|
:source => 'init',
|
||||||
:inital => true,
|
:initial => true,
|
||||||
:deletable => false,
|
:deletable => false,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
|
|
8
db/migrate/20150215082745_rename_avatar_typo.rb
Normal file
8
db/migrate/20150215082745_rename_avatar_typo.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
class RenameAvatarTypo < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
rename_column :avatars, :inital, :initial
|
||||||
|
end
|
||||||
|
def down
|
||||||
|
rename_column :avatars, :initial, :inital
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue