Created
June 15, 2012 13:48
-
-
Save almaron/2936556 to your computer and use it in GitHub Desktop.
A bug while displaying associated records.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Forum model | |
has_many :topics | |
#Topic model | |
belongs_to :forum | |
#forums#show action | |
def show | |
@forum = Forum::Forum.find_by_id(params[:id]) | |
if @forum.hidden > 0 && !(user_in?([:admins, :masters]) || user_permitted?(:show_hidden)) | |
url = case @forum.parent_id | |
when 0 then forums_path | |
else forum_path(@forum.parent) | |
end | |
redirect_to url | |
else | |
@topics = @forum.topics | |
@meta[:title] = "#{@forum.name} - #{t("forum.head.index")}" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment