Fixed Open Graph db insertion
This commit is contained in:
parent
01e0127287
commit
642e5ab45b
3 changed files with 15 additions and 5 deletions
|
|
@ -26,7 +26,7 @@ class OpenGraphCache < ActiveRecord::Base
|
||||||
|
|
||||||
return if response.blank? || response.type.blank?
|
return if response.blank? || response.type.blank?
|
||||||
|
|
||||||
self.title = response.title
|
self.title = response.title.truncate(255)
|
||||||
self.ob_type = response.type
|
self.ob_type = response.type
|
||||||
self.image = response.images[0]
|
self.image = response.images[0]
|
||||||
self.url = response.url
|
self.url = response.url
|
||||||
|
|
|
||||||
10
db/migrate/20140906192846_fix_open_graph_data.rb
Normal file
10
db/migrate/20140906192846_fix_open_graph_data.rb
Normal 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
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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|
|
create_table "account_deletions", force: true do |t|
|
||||||
t.string "diaspora_handle"
|
t.string "diaspora_handle"
|
||||||
|
|
@ -219,8 +219,8 @@ ActiveRecord::Schema.define(version: 20140826165533) do
|
||||||
create_table "open_graph_caches", force: true do |t|
|
create_table "open_graph_caches", force: true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.string "ob_type"
|
t.string "ob_type"
|
||||||
t.string "image"
|
t.text "image"
|
||||||
t.string "url"
|
t.text "url"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
end
|
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
|
add_foreign_key "share_visibilities", "contacts", name: "post_visibilities_contact_id_fk", dependent: :delete
|
||||||
|
|
||||||
end
|
end
|
||||||
Loading…
Reference in a new issue