public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
First run through renaming Events to Activities
kevinansfield (author)
Thu Mar 27 11:56:25 -0700 2008
commit  dfa1433850367d9e60ddbd68a05ccc13760fe156
tree    279f9d20de655a0ca5c326951ff30a5668c0bb03
parent  4c75a9f822209fa83736b68cf36129fc17e3e7df
...
13
14
15
16
17
 
 
...
13
14
15
 
16
17
18
0
@@ -13,4 +13,5 @@ uuid.state
0
 nbproject*
0
 index/*
0
 config/initializers/preferences.rb
0
-identifier
0
\ No newline at end of file
0
+identifier
0
+.project
...
28
29
30
31
 
32
33
34
35
36
37
 
 
 
38
39
40
41
42
 
 
 
43
44
45
...
28
29
30
 
31
32
33
34
 
 
 
35
36
37
38
39
 
 
 
40
41
42
43
44
45
0
@@ -28,18 +28,18 @@ class BlogPost < Post
0
   validates_length_of :title, :maximum => MAX_TITLE
0
   validates_length_of :body, :maximum => MAX_BODY
0
   
0
- after_create :log_event
0
+ after_create :log_activity
0
   
0
   private
0
   
0
- def log_event
0
- event = Event.create!(:item => self, :person => blog.person)
0
- add_events(blog.person, event)
0
+ def log_activity
0
+ activity = Activity.create!(:item => self, :person => blog.person)
0
+ add_activities(blog.person, activity)
0
     end
0
     
0
- def add_events(person, event)
0
- person.events << event
0
- person.contacts.each { |c| c.events << event }
0
+ def add_activities(person, activity)
0
+ person.activities << activity
0
+ person.contacts.each { |c| c.activities << activity }
0
     end
0
     
0
 end
...
21
22
23
24
 
25
26
27
28
29
30
31
 
 
 
 
32
33
34
35
36
 
 
 
37
38
...
21
22
23
 
24
25
26
27
 
 
 
 
28
29
30
31
32
33
 
 
 
34
35
36
37
38
0
@@ -21,18 +21,18 @@ class BlogPostComment < Comment
0
   validates_presence_of :commenter
0
   validates_length_of :body, :maximum => MAX_TEXT_LENGTH
0
   
0
- after_create :log_event
0
+ after_create :log_activity
0
   
0
   private
0
   
0
- def log_event
0
- event = Event.create!(:item => self, :person => commenter)
0
- add_events(post.blog.person, event)
0
- add_events(commenter, event)
0
+ def log_activity
0
+ activity = Activity.create!(:item => self, :person => commenter)
0
+ add_activities(post.blog.person, activity)
0
+ add_activities(commenter, activity)
0
     end
0
     
0
- def add_events(person, event)
0
- person.events << event
0
- person.contacts.each { |c| c.events << event }
0
+ def add_activities(person, activity)
0
+ person.activities << activity
0
+ person.contacts.each { |c| c.activities << activity }
0
     end
0
 end
...
63
64
65
66
 
67
68
69
 
70
71
72
...
63
64
65
 
66
67
68
 
69
70
71
72
0
@@ -63,10 +63,10 @@ class Connection < ActiveRecord::Base
0
         accepted_at = Time.now
0
         accept_one_side(person, contact, accepted_at)
0
         accept_one_side(contact, person, accepted_at)
0
- # Log a connection event.
0
+ # Log a connection activity.
0
         # pid = person.is_a?(Person) ? person.id : person
0
         # cid = conn(person, contact).id
0
- # Event.create!(:item => conn(person, contact))
0
+ # Activity.create!(:item => conn(person, contact))
0
       end
0
     end
0
   
...
9
10
11
12
 
13
14
...
9
10
11
 
12
13
14
0
@@ -9,6 +9,6 @@
0
 #
0
 
0
 class Feed < ActiveRecord::Base
0
- belongs_to :event
0
+ belongs_to :activity
0
   belongs_to :person
0
 end
...
22
23
24
25
 
26
27
28
29
30
31
 
 
 
32
33
34
35
36
 
 
 
37
38
...
22
23
24
 
25
26
27
28
 
 
 
29
30
31
32
33
 
 
 
34
35
36
37
38
0
@@ -22,17 +22,17 @@ class ForumPost < Post
0
   validates_presence_of :body, :topic, :person
0
   validates_length_of :body, :maximum => MAX_TEXT_LENGTH
0
   
0
- after_create :log_event
0
+ after_create :log_activity
0
   
0
   private
0
   
0
- def log_event
0
- event = Event.create!(:item => self, :person => person)
0
- add_events(person, event)
0
+ def log_activity
0
+ activity = Activity.create!(:item => self, :person => person)
0
+ add_activities(person, activity)
0
     end
0
     
0
- def add_events(person, event)
0
- person.events << event
0
- person.contacts.each { |c| c.events << event }
0
+ def add_activities(person, activity)
0
+ person.activities << activity
0
+ person.contacts.each { |c| c.activities << activity }
0
     end
0
 end
...
59
60
61
62
63
 
 
64
65
66
...
100
101
102
103
 
104
105
106
107
 
108
109
110
...
59
60
61
 
 
62
63
64
65
66
...
100
101
102
 
103
104
105
106
 
107
108
109
110
0
@@ -59,8 +59,8 @@ class Person < ActiveRecord::Base
0
                     :conditions => "recipient_deleted_at IS NULL"
0
   end
0
   has_many :feeds
0
- has_many :events, :through => :feeds,
0
- :order => 'created_at DESC', :limit => FEED_SIZE
0
+ has_many :activities, :through => :feeds,
0
+ :order => 'created_at DESC', :limit => FEED_SIZE
0
   
0
   validates_presence_of :email, :name
0
   validates_presence_of :password, :if => :password_required?
0
@@ -100,11 +100,11 @@ class Person < ActiveRecord::Base
0
   ## Feeds
0
   
0
   def feed
0
- events
0
+ activities
0
   end
0
   
0
   def recent_activity
0
- Event.find_all_by_person_id(self, :order => 'created_at DESC',
0
+ Activity.find_all_by_person_id(self, :order => 'created_at DESC',
0
                                       :limit => FEED_SIZE)
0
   end
0
   
...
25
26
27
28
 
29
30
31
...
33
34
35
36
37
38
 
 
 
39
40
41
42
43
 
 
 
44
45
...
25
26
27
 
28
29
30
31
...
33
34
35
 
 
 
36
37
38
39
40
 
 
 
41
42
43
44
45
0
@@ -25,7 +25,7 @@ class Topic < ActiveRecord::Base
0
   validates_presence_of :name, :forum, :person
0
   validates_length_of :name, :maximum => MAX_NAME
0
   
0
- after_create :log_event
0
+ after_create :log_activity
0
   
0
   def self.find_recent
0
     find(:all, :order => "created_at DESC", :limit => NUM_RECENT)
0
@@ -33,13 +33,13 @@ class Topic < ActiveRecord::Base
0
   
0
   private
0
   
0
- def log_event
0
- event = Event.create!(:item => self, :person => person)
0
- add_events(person, event)
0
+ def log_activity
0
+ activity = Activity.create!(:item => self, :person => person)
0
+ add_activities(person, activity)
0
     end
0
     
0
- def add_events(person, event)
0
- person.events << event
0
- person.contacts.each { |c| c.events << event }
0
+ def add_activities(person, activity)
0
+ person.activities << activity
0
+ person.contacts.each { |c| c.activities << activity }
0
     end
0
 end
...
21
22
23
24
 
25
26
27
28
29
30
 
 
 
31
32
33
34
35
 
 
 
36
37
...
21
22
23
 
24
25
26
27
 
 
 
28
29
30
31
32
 
 
 
33
34
35
36
37
0
@@ -21,17 +21,17 @@ class WallComment < Comment
0
   validates_presence_of :commenter
0
   validates_length_of :body, :maximum => SMALL_TEXT_LENGTH
0
   
0
- after_create :log_event
0
+ after_create :log_activity
0
   
0
   private
0
   
0
- def log_event
0
- event = Event.create!(:item => self, :person => person)
0
- add_events(person, event)
0
+ def log_activity
0
+ activity = Activity.create!(:item => self, :person => person)
0
+ add_activities(person, activity)
0
     end
0
     
0
- def add_events(person, event)
0
- person.events << event
0
- person.contacts.each { |c| c.events << event }
0
+ def add_activities(person, activity)
0
+ person.activities << activity
0
+ person.contacts.each { |c| c.activities << activity }
0
     end
0
 end
...
1
2
3
 
4
5
...
1
2
 
3
4
5
0
@@ -1,4 +1,4 @@
0
 <table>
0
   <tr><th colspan="2">Activity Feed</th></tr>
0
- <%= render :partial => 'shared/event', :collection => @feed %>
0
+ <%= render :partial => 'shared/activity', :collection => @feed %>
0
 </table>
0
\ No newline at end of file
...
5
6
7
8
 
9
10
11
...
5
6
7
 
8
9
10
11
0
@@ -5,7 +5,7 @@
0
       <tr>
0
         <th colspan="2">Recent Activity</th>
0
       </tr>
0
- <%= render :partial => 'shared/event',
0
+ <%= render :partial => 'shared/activity',
0
                  :collection => @person.recent_activity %>
0
     </table>
0
   </div>
...
1
2
3
4
 
5
6
7
 
 
8
9
10
...
1
2
3
 
4
5
 
 
6
7
8
9
10
0
@@ -1,10 +1,10 @@
0
 <%- if logged_in? -%>
0
   <table class="minifeed">
0
   <tr><th colspan="2">Minifeed</th></tr>
0
- <%- current_person.feed.each do |event| -%>
0
+ <%- current_person.feed.each do |activity| -%>
0
   <tr>
0
- <td><%= minifeed_message event %></td>
0
- <td><%= image_link event.person %></td>
0
+ <td><%= minifeed_message activity %></td>
0
+ <td><%= image_link activity.person %></td>
0
   </tr>
0
   <%- end -%>
0
   </table>
...
1
2
 
3
4
5
...
1
 
2
3
4
5
0
@@ -1,5 +1,5 @@
0
 ActionController::Routing::Routes.draw do |map|
0
- map.resources :events
0
+ map.resources :activities
0
   map.resources :connections
0
   map.resources :password_reminders
0
   map.resources :photos
...
104
105
106
107
108
109
110
 
 
 
 
111
112
113
...
104
105
106
 
 
 
 
107
108
109
110
111
112
113
0
@@ -104,10 +104,10 @@ end
0
 
0
 # Make a less-boring sample feed.
0
 def make_feed
0
- # Mix up events for variety.
0
- default_person.events.each do |event|
0
- event.created_at = rand(20).hours.ago
0
- event.save!
0
+ # Mix up activities for variety.
0
+ default_person.activities.each do |activity|
0
+ activity.created_at = rand(20).hours.ago
0
+ activity.save!
0
   end
0
 end
0
 
...
27
28
29
30
 
31
32
33
34
 
 
35
36
37
38
 
 
39
40
41
42
 
 
43
44
45
...
27
28
29
 
30
31
32
 
 
33
34
35
36
 
 
37
38
39
40
 
 
41
42
43
44
45
0
@@ -27,19 +27,19 @@ describe BlogPostComment do
0
     
0
     before(:each) do
0
       @comment.save!
0
- @event = Event.find_by_item_id(@comment)
0
+ @activity = Activity.find_by_item_id(@comment)
0
     end
0
 
0
- it "should have an event" do
0
- @event.should_not be_nil
0
+ it "should have an activity" do
0
+ @activity.should_not be_nil
0
     end
0
     
0
- it "should add an event to the poster" do
0
- @comment.post.blog.person.events.include?(@event).should == true
0
+ it "should add an activity to the poster" do
0
+ @comment.post.blog.person.activities.include?(@activity).should == true
0
     end
0
 
0
- it "should add an event to the commenter" do
0
- @comment.commenter.events.include?(@event).should == true
0
+ it "should add an activity to the commenter" do
0
+ @comment.commenter.activities.include?(@activity).should == true
0
     end
0
   end
0
 end
...
29
30
31
32
 
33
34
35
36
 
37
38
39
40
 
 
41
42
43
44
 
 
45
46
47
...
56
57
58
59
 
60
61
62
 
 
63
64
65
...
29
30
31
 
32
33
34
35
 
36
37
38
 
 
39
40
41
42
 
 
43
44
45
46
47
...
56
57
58
 
59
60
 
 
61
62
63
64
65
0
@@ -29,19 +29,19 @@ describe BlogPost do
0
     @post.should have_maximum(:body, BlogPost::MAX_BODY)
0
   end
0
     
0
- describe "post event associations" do
0
+ describe "post activity associations" do
0
     
0
     before(:each) do
0
       @post.save!
0
- @event = Event.find_by_item_id(@post)
0
+ @activity = Activity.find_by_item_id(@post)
0
     end
0
     
0
- it "should have an event" do
0
- @event.should_not be_nil
0
+ it "should have an activity" do
0
+ @activity.should_not be_nil
0
     end
0
     
0
- it "should add an event to the poster" do
0
- @post.blog.person.events.include?(@event).should == true
0
+ it "should add an activity to the poster" do
0
+ @post.blog.person.activities.include?(@activity).should == true
0
     end
0
   end
0
   
0
@@ -56,10 +56,10 @@ describe BlogPost do
0
       @post.comments.should_not be_empty
0
     end
0
     
0
- it "should add events to the poster" do
0
+ it "should add activities to the poster" do
0
       @post.comments.each do |comment|
0
- event = Event.find_by_item_id(comment)
0
- @post.blog.person.events.include?(event).should == true
0
+ activity = Activity.find_by_item_id(comment)
0
+ @post.blog.person.activities.include?(activity).should == true
0
       end
0
     end
0
   end
...
55
56
57
58
 
59
60
61
62
63
64
 
65
66
67
68
 
 
69
70
71
...
55
56
57
 
58
59
60
61
62
63
 
64
65
66
 
 
67
68
69
70
71
0
@@ -55,17 +55,17 @@ describe Connection do
0
     end
0
   end
0
   
0
- # describe "event associations" do
0
+ # describe "activity associations" do
0
   #
0
   # before(:each) do
0
   # Connection.request(@person, @contact)
0
   # @connection = Connection.conn(@person, @contact)
0
   # @connection.accept
0
- # Event.find_by_item_id(@connection)
0
+ # Activity.find_by_item_id(@connection)
0
   # end
0
   #
0
- # it "should have an event" do
0
- # @event.should_not be_nil
0
+ # it "should have an activity" do
0
+ # activity.should_not be_nil
0
   # end
0
   # end
0
 
...
26
27
28
29
 
30
31
32
33
 
 
34
35
36
37
 
 
38
39
40
...
26
27
28
 
29
30
31
 
 
32
33
34
35
 
 
36
37
38
39
40
0
@@ -26,15 +26,15 @@ describe ForumPost do
0
     
0
     before(:each) do
0
       @post.save!
0
- @event = Event.find_by_item_id(@post)
0
+ @activity = Activity.find_by_item_id(@post)
0
     end
0
 
0
- it "should have an event" do
0
- @event.should_not be_nil
0
+ it "should have an activity" do
0
+ @activity.should_not be_nil
0
     end
0
     
0
- it "should add an event to the poster" do
0
- @post.person.events.include?(@event).should == true
0
+ it "should add an activity to the poster" do
0
+ @post.person.activities.include?(@activity).should == true
0
     end
0
   end
0
 end
...
37
38
39
40
41
 
 
42
43
44
...
37
38
39
 
 
40
41
42
43
44
0
@@ -37,8 +37,8 @@ describe Topic do
0
       @topic.save!
0
     end
0
 
0
- it "should have an event" do
0
- Event.find_by_item_id(@topic).should_not be_nil
0
+ it "should have an activity" do
0
+ Activity.find_by_item_id(@topic).should_not be_nil
0
     end
0
   end
0
 end
...
29
30
31
32
33
 
 
34
35
36
...
29
30
31
 
 
32
33
34
35
36
0
@@ -29,8 +29,8 @@ describe WallComment do
0
       @comment.save!
0
     end
0
 
0
- it "should have an event" do
0
- Event.find_by_item_id(@comment).should_not be_nil
0
+ it "should have an activity" do
0
+ Activity.find_by_item_id(@comment).should_not be_nil
0
     end
0
   end
0
 end

Comments

    No one has commented yet.