Fixed Open Graph db insertion

This commit is contained in:
jaideng123 2014-09-06 14:44:54 -05:00
parent 01e0127287
commit 642e5ab45b
3 changed files with 15 additions and 5 deletions

View file

@ -26,7 +26,7 @@ class OpenGraphCache < ActiveRecord::Base
return if response.blank? || response.type.blank?
self.title = response.title
self.title = response.title.truncate(255)
self.ob_type = response.type
self.image = response.images[0]
self.url = response.url

View file

@ -0,0 +1,10 @@
class FixOpenGraphData < ActiveRecord::Migration
def self.up
change_column :open_graph_caches, :url, :text
change_column :open_graph_caches, :image, :text
end
def self.down
change_column :open_graph_caches, :url, :string
change_column :open_graph_caches, :image, :string
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140826165533) do
ActiveRecord::Schema.define(version: 20140906192846) do
create_table "account_deletions", force: true do |t|
t.string "diaspora_handle"
@ -219,8 +219,8 @@ ActiveRecord::Schema.define(version: 20140826165533) do
create_table "open_graph_caches", force: true do |t|
t.string "title"
t.string "ob_type"
t.string "image"
t.string "url"
t.text "image"
t.text "url"
t.text "description"
end
@ -570,4 +570,4 @@ ActiveRecord::Schema.define(version: 20140826165533) do
add_foreign_key "share_visibilities", "contacts", name: "post_visibilities_contact_id_fk", dependent: :delete
end
end