diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index c8699937a..6f496eb10 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -8,7 +8,7 @@ module NotificationsHelper when 'new_request' translation when 'comment_on_post' - "#{translation} #{link_to t('notifications.post'), object_path(Comment.first(:id => note.object_id).post)}".html_safe + "#{translation} #{link_to t('notifications.post'), object_path(Comment.first(:id => note.target_id).post)}".html_safe else end end diff --git a/app/models/notification.rb b/app/models/notification.rb index 4068da5dd..6282e4765 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -5,7 +5,7 @@ class Notification include MongoMapper::Document - key :object_id, ObjectId + key :target_id, ObjectId key :kind, String key :unread, Boolean, :default => true @@ -14,7 +14,7 @@ class Notification timestamps! - attr_accessible :object_id, :kind, :user_id, :person_id, :unread + attr_accessible :target_id, :kind, :user_id, :person_id, :unread def self.for(user, opts={}) self.where(opts.merge!(:user_id => user.id)).order('created_at desc') @@ -23,7 +23,7 @@ class Notification def self.notify(user, object, person) if object.respond_to? :notification_type if kind = object.notification_type(user, person) - Notification.create(:object_id => object.id, + Notification.create(:target_id => object.id, :kind => kind, :person_id => person.id, :user_id => user.id) diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index fc5329e46..3267554f4 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -12,7 +12,7 @@ describe Notification do @user = make_user @user2 = make_user @aspect = @user.aspects.create(:name => "dudes") - @opts = {:object_id => @sm.id, :kind => @sm.class.name, :person_id => @person.id, :user_id => @user.id} + @opts = {:target_id => @sm.id, :kind => @sm.class.name, :person_id => @person.id, :user_id => @user.id} @note = Notification.new(@opts) end @@ -20,8 +20,8 @@ describe Notification do @note.kind.should == StatusMessage.name end - it 'contains a object_id' do - @note.object_id.should == @sm.id + it 'contains a target_id' do + @note.target_id.should == @sm.id end it 'contains a person_id' do