forked from OpenNeo/impress
move from deprecated def before_save to before_save do
This commit is contained in:
parent
33711f6fc6
commit
5c34b79186
4 changed files with 6 additions and 6 deletions
|
@ -106,12 +106,12 @@ class Item < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_create
|
before_create do
|
||||||
self.sold_in_mall = false
|
self.sold_in_mall = false
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_save
|
before_save do
|
||||||
if @parent_swf_asset_relationships_to_update && @current_body_id
|
if @parent_swf_asset_relationships_to_update && @current_body_id
|
||||||
new_swf_asset_ids = @parent_swf_asset_relationships_to_update.map(&:swf_asset_id)
|
new_swf_asset_ids = @parent_swf_asset_relationships_to_update.map(&:swf_asset_id)
|
||||||
rels = ParentSwfAssetRelationship.arel_table
|
rels = ParentSwfAssetRelationship.arel_table
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Pet < ActiveRecord::Base
|
||||||
uri.to_s
|
uri.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_save
|
before_save do
|
||||||
self.pet_type.save
|
self.pet_type.save
|
||||||
self.items.each(&:save)
|
self.items.each(&:save)
|
||||||
end
|
end
|
||||||
|
|
|
@ -66,7 +66,7 @@ class PetType < ActiveRecord::Base
|
||||||
pet_state
|
pet_state
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_save
|
before_save do
|
||||||
if @origin_pet
|
if @origin_pet
|
||||||
cpn_uri = URI.parse sprintf(IMAGE_CPN_FORMAT, @origin_pet.name);
|
cpn_uri = URI.parse sprintf(IMAGE_CPN_FORMAT, @origin_pet.name);
|
||||||
res = Net::HTTP.get_response(cpn_uri)
|
res = Net::HTTP.get_response(cpn_uri)
|
||||||
|
|
|
@ -53,7 +53,7 @@ class SwfAsset < ActiveRecord::Base
|
||||||
self.url = data[:asset_url]
|
self.url = data[:asset_url]
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_create
|
before_create do
|
||||||
uri = URI.parse url
|
uri = URI.parse url
|
||||||
response = Net::HTTP.get_response(uri)
|
response = Net::HTTP.get_response(uri)
|
||||||
if response.is_a? Net::HTTPSuccess
|
if response.is_a? Net::HTTPSuccess
|
||||||
|
@ -75,7 +75,7 @@ class SwfAsset < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_save
|
before_save do
|
||||||
# If an asset body ID changes, that means more than one body ID has been
|
# If an asset body ID changes, that means more than one body ID has been
|
||||||
# linked to it, meaning that it's probably wearable by all bodies.
|
# linked to it, meaning that it's probably wearable by all bodies.
|
||||||
self.body_id = 0 if self.body_id_changed? || !self.body_specific?
|
self.body_id = 0 if self.body_id_changed? || !self.body_specific?
|
||||||
|
|
Loading…
Reference in a new issue