add pixiv id search

This commit is contained in:
albert
2013-03-31 14:43:54 -04:00
parent fc32a0023c
commit e2c2a8309d
7 changed files with 55 additions and 15 deletions

View File

@@ -2,5 +2,14 @@
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
kv = KeyValue.find_or_create_by_key("ApiCacheGenerator.generate_tag_cache")
kv.update_attribute(:value, "0")
1.upto(2) do |i|
Post.where("source like ?", "http://i#{i}.pixiv.net%").find_each do |post|
post.parse_pixiv_id
post.update_column(:pixiv_id, post.pixiv_id) if post.pixiv_id.present?
end
end
Post.where("source like ?", "http://www.pixiv.net%").find_each do |post|
post.parse_pixiv_id
post.update_column(:pixiv_id, post.pixiv_id) if post.pixiv_id.present?
end