Skip to content

Commit

Permalink
Merge branch 'master' of git@git.caboo.se:altered_beast
Browse files Browse the repository at this point in the history
  • Loading branch information
courtenay committed Oct 14, 2008
2 parents 94f575d + 8022868 commit bd2322c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/models/user.rb
Expand Up @@ -9,7 +9,11 @@ class User < ActiveRecord::Base
has_many :topics, :order => "#{Topic.table_name}.created_at desc"

has_many :moderatorships, :dependent => :delete_all
has_many :forums, :through => :moderatorships, :source => :forum
has_many :forums, :through => :moderatorships, :source => :forum do
def moderatable
find :all, :select => "#{Forum.table_name}.*, #{Moderatorship.table_name}.id as moderatorship_id"
end
end

has_many :monitorships, :dependent => :delete_all
has_many :monitored_topics, :through => :monitorships, :source => :topic, :conditions => {"#{Monitorship.table_name}.active" => true}
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Expand Up @@ -11,7 +11,7 @@
<p><%= 'This user can moderate the following forums. Click one to remove.'[:remove_moderated_forum] %></p>

<ul class="flat">
<% @user.forums.find(:all, :select => "#{Forum.table_name}.*, #{Moderatorship.table_name}.id as moderatorship_id").each do |forum| -%>
<% @user.forums.moderatable.each do |forum| -%>
<li>
<%= link_to forum.name, moderatorship_path(forum.moderatorship_id), :method => :delete, :confirm => "#{'Remove user as moderator for'[:remove_user_as_moderator]} #{forum.name}?" %>
</li>
Expand Down

0 comments on commit bd2322c

Please sign in to comment.