public
Description: El Dorado is a full-stack community web application written in Ruby/Rails.
Homepage: http://almosteffortless.com/eldorado/
Clone URL: git://github.com/trevorturk/el-dorado.git
changing User.bloggers to User.blog_authors, testing, adding a bit of 
display logic to hide if only one author
trevorturk (author)
Sat Jul 26 10:03:32 -0700 2008
commit  af79bd73992dc1c401d9721f294387e937b158fe
tree    173cbb7bac373cd7f696dcaa381ad4c1a3a83a75
parent  5ce70e8f1b66a8c87844f0fd05d342d6b3111231
...
26
27
28
29
 
30
31
32
...
26
27
28
 
29
30
31
32
0
@@ -26,7 +26,7 @@ class User < ActiveRecord::Base
0
   
0
   attr_protected :id, :created_at, :admin, :posts_count
0
   
0
- named_scope :bloggers, :conditions => 'articles_count > 0', :order => 'articles_count desc'
0
+ named_scope :blog_authors, :conditions => 'articles_count > 0', :order => 'articles_count desc'
0
   named_scope :chatting, lambda {|*args| {:conditions => ['chatting_at > ?', Time.now.utc-30.seconds], :order => 'login asc'}}
0
   named_scope :online, lambda {|*args| {:conditions => ['logged_out = ? and (online_at > ? or chatting_at > ?)', false, Time.now.utc-5.minutes, Time.now.utc-30.seconds], :order => 'login asc'}}
0
   
...
1
2
 
 
3
4
5
...
 
 
1
2
3
4
5
0
@@ -1,5 +1,5 @@
0
-<% @bloggers ||= User.bloggers %>
0
-<% if @bloggers %>
0
+<% @bloggers ||= User.blog_authors %>
0
+<% if @bloggers && @bloggers.size > 1 %>
0
   <div class="title"><%= link_to 'Authors', users_path %></div>
0
   <ul class="secondary-list">
0
     <% @bloggers.each do |user| %>
...
2
3
4
5
6
7
 
 
8
9
10
...
2
3
4
 
 
 
5
6
7
8
9
0
@@ -2,9 +2,8 @@ require 'test_helper'
0
 
0
 class ArticleTest < ActiveSupport::TestCase
0
   
0
- def test_get
0
-
0
- end
0
+ # def test_get
0
+ # end
0
   
0
   def test_to_s
0
     t = Article.first
...
17
18
19
20
 
 
 
 
 
 
 
21
22
23
24
25
26
...
17
18
19
 
20
21
22
23
24
25
26
27
28
29
30
 
31
0
@@ -17,10 +17,15 @@ class UserTest < Test::Unit::TestCase
0
     u = User.create(:login => "test", :email => "email@address.com", :password => "sdlfkj", :password_confirmation => "sdlfkj")
0
     assert u.valid?
0
   end
0
-
0
+
0
+ def test_blog_authors
0
+ users(:trevor).articles.create(:title => 'test', :body => 'test')
0
+ authors = User.blog_authors
0
+ assert_equal true, authors.include?(users(:trevor))
0
+ end
0
+
0
   def test_to_s
0
     u = User.find(1)
0
     assert_equal u.to_s, 'Guest'
0
   end
0
-
0
 end

Comments

    No one has commented yet.