rostra 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,5 @@
1
1
  module Rostra
2
2
  class Question < ActiveRecord::Base
3
- include Rostra::TimestampObserver
4
3
  extend FriendlyId
5
4
 
6
5
  belongs_to :user
@@ -35,12 +34,6 @@ module Rostra
35
34
  @answer_count = answers.count
36
35
  end
37
36
 
38
- # The last time the question has had any activity (i.e. commment, answer, etc).
39
- #
40
- def active_at
41
- updated_at || created_at
42
- end
43
-
44
37
  private
45
38
 
46
39
  def create_question_following
@@ -39,7 +39,7 @@
39
39
  <%= strip_tags(question.details) %>
40
40
  <% end %>
41
41
  </div>
42
- <div class="timestamp">active <%= time_ago_in_words(question.active_at) %> ago</div>
42
+ <div class="timestamp">active <%= time_ago_in_words(question.active_at || question.updated_at) %> ago</div>
43
43
  <%= tag_list(question) %>
44
44
  </div>
45
45
  <div class="clear"></div>
@@ -0,0 +1,5 @@
1
+ class AddActiveAtToQuestions < ActiveRecord::Migration
2
+ def change
3
+ add_column :rostra_questions, :active_at, :datetime
4
+ end
5
+ end
@@ -9,7 +9,7 @@ module Rostra
9
9
 
10
10
  def set_active_at
11
11
  question = self.is_a?(Rostra::Question) ? self : self.question
12
- question.touch
12
+ question.update_attribute(:active_at, Time.now)
13
13
  end
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Rostra
2
- VERSION = "0.1.20"
2
+ VERSION = "0.1.21"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rostra
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.20
5
+ version: 0.1.21
6
6
  platform: ruby
7
7
  authors:
8
8
  - Cory Schires
@@ -570,6 +570,7 @@ files:
570
570
  - db/migrate/20111106162542_add_votes_count_to_rostra_answers.rb
571
571
  - db/migrate/20111106164824_add_votes_count_to_rostra_questions.rb
572
572
  - db/migrate/20111113220522_add_slug_to_questions.rb
573
+ - db/migrate/20111115213534_add_active_at_to_questions.rb
573
574
  - lib/generators/rostra/install_generator.rb
574
575
  - lib/generators/rostra/templates/app/helpers/rostra/application_helper.rb
575
576
  - lib/generators/rostra/templates/config/initializers/rostra.rb