Cross Reference: 20160719133546_preload_locids.rb
xref
: /
ontohub
/
db
/
data
/
20160719133546_preload_locids.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
20160719133546_preload_locids.rb revision 7504caafc305ac4cc1cf9973810e30117039f9f8
class
PreloadLocids
<
ActiveRecord
::
Migration
def
self.up
LocId.where
(
specific_type
:
Sentence.descendants.map
(&:
to_s
)
)
.
update_all
(
specific_type
:
Sentence.to
_s
)
end
def
self.down
Sentence.find
_each
do
|
object
|
klass
=
object.class.to
_s
loc_id
=
object.loc_ids.first
loc_id.specific
_type
=
klass
loc_id.save
end
end
end