Defect #2

Listing 5 projects on Welcome page

Added by Todd McGrath almost 16 years ago. Updated about 10 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Resolution: Affected version:



I think there is an issue on the welcome.rhtml page when the code lists all the projects:

<div class="splitcontentright">
<div class="box">
<% for project in @projects >
= link_to, :controller => 'projects', :action => 'show', :id => project > (<=
format_time(project.created_on) >)<br />
=h project.description >
end %>

Or, perhaps more importantly in the welcome_controller.rb:

def index
@news = News.latest
@projects = Project.latest

Reason: If a user clicks on a non-public project where he is not a member, they will receive a blank page (error).

Perhaps it will be better not to see private projects where the user is not a member?

As a potential solution, let's update the Project.latest method to return 5 projects where logged_in_user is a member
or the project is public?

What do you think?


welcome_controller.rb-PATCH.txt Magnifier (480 Bytes) Todd McGrath, 2008-02-03 10:48

project.rb-PATCH.txt Magnifier (735 Bytes) Todd McGrath, 2008-02-03 10:48

Associated revisions

Revision 473
Added by Jean-Philippe Lang over 15 years ago

Commit messages are now scanned for referenced or fixed issue IDs.
Keywords and the status to apply to fixed issues can be defined in Admin -> Settings.

Default keywords:
- for referencing issues: refs, references, IssueID
- for fixing issues: fixes,closes
There's no default status defined for fixed issue. You'll have to specify it if you want to enable auto closure of issues.

Example of a working commit message: "This commit references #1, #2 and fixes #3"


#1 Updated by Jean-Philippe Lang almost 16 years ago

Happy new year Todd !
I've corrected this bug, with a slight different solution (your
code was good but i prefer not to add a join).
I've modified "Latest news" too so that they are displayed
according to user's membership.
Just a thing about your code: don't forget that logged_in_user
can be nil (if nobody's logged).

Best regards,


#2 Updated by Todd McGrath almost 16 years ago


I'll attach two patch files that solved it
(project.rb-PATCH.txt and welcome_controller.rb-PATCH.txt).
What do you think? (I'm coming from Java and trying to
learn more Ruby/Rails. I'm not very confident in Ruby yet
and appreciate any feedback)


Also available in: Atom PDF