Skip to content
Extraits de code Groupes Projets
Valider d12944d5 rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

record objectId in post (cant use object_id booo)

parent c6d61c68
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Chargement en cours
...@@ -12,11 +12,13 @@ class ActivityStreams::Photo < Post ...@@ -12,11 +12,13 @@ class ActivityStreams::Photo < Post
xml_attr :object_url xml_attr :object_url
xml_attr :provider_display_name xml_attr :provider_display_name
xml_attr :actor_url xml_attr :actor_url
xml_attr :objectId
validates_presence_of :image_url, validates_presence_of :image_url,
:object_url, :object_url,
:provider_display_name, :provider_display_name,
:actor_url :actor_url,
:objectId
def socket_to_user(user_or_id, opts={}) #adds aspect_ids to opts if they are not there def socket_to_user(user_or_id, opts={}) #adds aspect_ids to opts if they are not there
unless opts[:aspect_ids] unless opts[:aspect_ids]
...@@ -35,6 +37,7 @@ class ActivityStreams::Photo < Post ...@@ -35,6 +37,7 @@ class ActivityStreams::Photo < Post
:image_height => json["object"]["image"]["height"], :image_height => json["object"]["image"]["height"],
:image_width => json["object"]["image"]["width"], :image_width => json["object"]["image"]["width"],
:object_url => json["object"]["url"], :object_url => json["object"]["url"],
:objectId => json["object"]["id"],
:provider_display_name => json["provider"]["displayName"], :provider_display_name => json["provider"]["displayName"],
:actor_url => json["actor"]["url"] :actor_url => json["actor"]["url"]
......
class AddObjectIdToPost < ActiveRecord::Migration
def self.up
add_column(:posts, :objectId, :integer)
execute("UPDATE posts SET objectId = object_url")
end
def self.down
add_column(:posts, :objectId, :integer)
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110518222303) do ActiveRecord::Schema.define(:version => 20110524184202) do
create_table "aspect_memberships", :force => true do |t| create_table "aspect_memberships", :force => true do |t|
t.integer "aspect_id", :null => false t.integer "aspect_id", :null => false
...@@ -248,6 +248,7 @@ ActiveRecord::Schema.define(:version => 20110518222303) do ...@@ -248,6 +248,7 @@ ActiveRecord::Schema.define(:version => 20110518222303) do
t.integer "image_width" t.integer "image_width"
t.string "provider_display_name" t.string "provider_display_name"
t.string "actor_url" t.string "actor_url"
t.integer "objectId"
end end
add_index "posts", ["author_id"], :name => "index_posts_on_person_id" add_index "posts", ["author_id"], :name => "index_posts_on_person_id"
......
...@@ -109,7 +109,8 @@ Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p| ...@@ -109,7 +109,8 @@ Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p|
p.image_url "http://example.com/awesome.png" p.image_url "http://example.com/awesome.png"
p.image_height 9001 p.image_height 9001
p.image_width 4 p.image_width 4
p.object_url "http://example.com/awesome_things.html" p.object_url "http://example.com/awesome_things.gif"
p.objectId "http://example.com/awesome_things.gif"
p.actor_url "http://notcubbi.es/cubber" p.actor_url "http://notcubbi.es/cubber"
p.provider_display_name "not cubbies" p.provider_display_name "not cubbies"
end end
...@@ -19,6 +19,7 @@ JSON ...@@ -19,6 +19,7 @@ JSON
photo.image_height.should == @json["object"]["image"]["height"] photo.image_height.should == @json["object"]["image"]["height"]
photo.image_width.should == @json["object"]["image"]["width"] photo.image_width.should == @json["object"]["image"]["width"]
photo.object_url.should == @json["object"]["url"] photo.object_url.should == @json["object"]["url"]
photo.objectId.should == @json["object"]["id"]
photo.provider_display_name.should == @json["provider"]["displayName"] photo.provider_display_name.should == @json["provider"]["displayName"]
photo.actor_url.should == @json["actor"]["url"] photo.actor_url.should == @json["actor"]["url"]
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter