fixed null value bug in rake task
This commit is contained in:
parent
e7087af6bc
commit
2ce8177333
2 changed files with 6 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
namespace 'db' do
|
namespace 'db' do
|
||||||
desc 'Populate the node_tags table'
|
desc 'Adds a version number to the noes table'
|
||||||
task :node_version do
|
task :node_version do
|
||||||
require File.dirname(__FILE__) + '/../../config/environment'
|
require File.dirname(__FILE__) + '/../../config/environment'
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace 'db' do
|
||||||
temp_old_node.visible = node.visible
|
temp_old_node.visible = node.visible
|
||||||
temp_old_node.timestamp = node.timestamp
|
temp_old_node.timestamp = node.timestamp
|
||||||
temp_old_node.tile = node.tile
|
temp_old_node.tile = node.tile
|
||||||
temp_old_node.version = node.version
|
temp_old_node.version = n
|
||||||
temp_old_node.save! || raise
|
temp_old_node.save! || raise
|
||||||
n +=1
|
n +=1
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace 'db' do
|
||||||
node.tags.split(';').each do |tag|
|
node.tags.split(';').each do |tag|
|
||||||
nt = NodeTag.new
|
nt = NodeTag.new
|
||||||
nt.id = node.id
|
nt.id = node.id
|
||||||
nt.k = tag.split('=')[0]
|
nt.k = tag.split('=')[0] || ''
|
||||||
nt.v = tag.split('=')[1]
|
nt.v = tag.split('=')[1] || ''
|
||||||
nt.sequence_id = seq_id
|
nt.sequence_id = seq_id
|
||||||
nt.save! || raise
|
nt.save! || raise
|
||||||
seq_id += 1
|
seq_id += 1
|
||||||
|
@ -26,8 +26,8 @@ namespace 'db' do
|
||||||
old_node.tags.split(';').each do |tag|
|
old_node.tags.split(';').each do |tag|
|
||||||
ont = OldNodeTag.new
|
ont = OldNodeTag.new
|
||||||
ont.id = node.id #the id of the node tag
|
ont.id = node.id #the id of the node tag
|
||||||
ont.k = tag.split('=')[0]
|
ont.k = tag.split('=')[0] || ''
|
||||||
ont.v = tag.split('=')[1]
|
ont.v = tag.split('=')[1] || ''
|
||||||
ont.version = version
|
ont.version = version
|
||||||
ont.sequence_id = sequence_id
|
ont.sequence_id = sequence_id
|
||||||
ont.save! || raise
|
ont.save! || raise
|
||||||
|
|
Loading…
Add table
Reference in a new issue