Skip to content

Commit

Permalink
Adding last_activity_at on public profile (needs timezone handling)
Browse files Browse the repository at this point in the history
Changing to rails 2.1.1
  • Loading branch information
Tair Assimov authored and stevenbristol committed Oct 7, 2008
1 parent 7a19152 commit 4e03c97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/controllers/application.rb
Expand Up @@ -23,6 +23,7 @@ def pagination_defaults

def set_profile
@p = @u.profile if @u && @u.profile
@p.update_attribute :last_activity_at, Time.now if @p
end


Expand Down
3 changes: 2 additions & 1 deletion app/views/profiles/_bio.html.erb
Expand Up @@ -4,7 +4,8 @@ profile ||= @profile
<div class="activity_box learn">
<div class="left avatar"><%= icon profile, :big %></div>
<div class="right bio_stuff">
<h1><%= h profile.f %></h1>
<h1><%= h profile.f %></h1>
<% unless profile.last_activity_at.blank? %><small>Last seen <%= time_ago_in_words profile.last_activity_at %> ago</small><% end %>
<h3><%= location_link profile %></h3>
<% unless profile.about_me.blank? %><div><strong>About:</strong> <%= sanitize(textilize(profile.about_me)) %></div><% end %>
<% unless profile.website.blank? %><div><strong>Website:</strong> <%= link_to h(profile.website), h(profile.website) %></div><% end %>
Expand Down
2 changes: 1 addition & 1 deletion config/environment.rb
@@ -1,5 +1,5 @@

RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = '2.1.1' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/006_add_profile_last_activity_at.rb
@@ -0,0 +1,9 @@
class AddProfileLastActivityAt < ActiveRecord::Migration
def self.up
add_column :profiles, :last_activity_at, :datetime
end

def self.down
remove_column :last_activity_at
end
end

0 comments on commit 4e03c97

Please sign in to comment.