record objectId in post (cant use object_id booo)
This commit is contained in:
parent
c6d61c68c0
commit
d12944d57e
5 changed files with 19 additions and 3 deletions
|
|
@ -12,11 +12,13 @@ class ActivityStreams::Photo < Post
|
|||
xml_attr :object_url
|
||||
xml_attr :provider_display_name
|
||||
xml_attr :actor_url
|
||||
xml_attr :objectId
|
||||
|
||||
validates_presence_of :image_url,
|
||||
:object_url,
|
||||
: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
|
||||
unless opts[:aspect_ids]
|
||||
|
|
@ -35,6 +37,7 @@ class ActivityStreams::Photo < Post
|
|||
:image_height => json["object"]["image"]["height"],
|
||||
:image_width => json["object"]["image"]["width"],
|
||||
:object_url => json["object"]["url"],
|
||||
:objectId => json["object"]["id"],
|
||||
|
||||
:provider_display_name => json["provider"]["displayName"],
|
||||
:actor_url => json["actor"]["url"]
|
||||
|
|
|
|||
10
db/migrate/20110524184202_add_object_id_to_post.rb
Normal file
10
db/migrate/20110524184202_add_object_id_to_post.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
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 @@
|
|||
#
|
||||
# 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|
|
||||
t.integer "aspect_id", :null => false
|
||||
|
|
@ -248,6 +248,7 @@ ActiveRecord::Schema.define(:version => 20110518222303) do
|
|||
t.integer "image_width"
|
||||
t.string "provider_display_name"
|
||||
t.string "actor_url"
|
||||
t.integer "objectId"
|
||||
end
|
||||
|
||||
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|
|
|||
p.image_url "http://example.com/awesome.png"
|
||||
p.image_height 9001
|
||||
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.provider_display_name "not cubbies"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ JSON
|
|||
photo.image_height.should == @json["object"]["image"]["height"]
|
||||
photo.image_width.should == @json["object"]["image"]["width"]
|
||||
photo.object_url.should == @json["object"]["url"]
|
||||
photo.objectId.should == @json["object"]["id"]
|
||||
|
||||
photo.provider_display_name.should == @json["provider"]["displayName"]
|
||||
photo.actor_url.should == @json["actor"]["url"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue