app/controllers/comments_controller.rb
def redirect_to_comment(comment, options = {})
    if comment.depth > ArchiveConfig.COMMENT_THREAD_MAX_DEPTH
      if comment.ultimate_parent.is_a?(Tag)
        default_options = {
           :controller => :comments,
           :action => :show,
           :id => comment.commentable.id,
           :tag_id => comment.ultimate_parent.to_param,
           :anchor => "comment_#{comment.id}"
        }
      else
        default_options = {
           :controller => comment.commentable.class.to_s.underscore.pluralize,
           :action => :show,
           :id => (comment.commentable.is_a?(Tag) ? comment.commentable.to_param : comment.commentable.id),
           :anchor => "comment_#{comment.id}"
        }
      end
      # display the comment's direct parent (and its associated thread)
      redirect_to(url_for(default_options.merge(options)))
    else
      # need to redirect to the specific chapter; redirect_to_all will then retrieve full work view if applicable
      redirect_to_all_comments(comment.parent, options.merge({:show_comments => true, :anchor => "comment_#{comment.id}"}))
    end
  end
# redirect to a particular comment in a thread, going into the thread
# if necessary to display it
redirect to a particular comment in a thread, going into the thread
if necessary to display it
redirect to a particular comment in a thread going into the thread if necessary to display it
def redirect_to_comment(comment, options = {})
    if comment.depth > ArchiveConfig.COMMENT_THREAD_MAX_DEPTH
      if comment.ultimate_parent.is_a?(Tag)
        default_options = {
           :controller => :comments,
           :action => :show,
           :id => comment.commentable.id,
           :tag_id => comment.ultimate_parent.to_param,
           :anchor => "comment_#{comment.id}"
        }
      else
        default_options = {
           :controller => comment.commentable.class.to_s.underscore.pluralize,
           :action => :show,
           :id => (comment.commentable.is_a?(Tag) ? comment.commentable.to_param : comment.commentable.id),
           :anchor => "comment_#{comment.id}"
        }
      end
      redirect_to(url_for(default_options.merge(options)))
    else
      redirect_to_all_comments(comment.parent, options.merge({:show_comments => true, :anchor => "comment_#{comment.id}"}))
    end
  end
def redirect_to_comment ( comment , options = { } ) if comment . depth > ArchiveConfig . COMMENT_THREAD_MAX_DEPTH if comment . ultimate_parent . is_a? ( Tag ) default_options = { :controller => :comments , :action => :show , :id => comment . commentable . id , :tag_id => comment . ultimate_parent . to_param , :anchor => "comment_#{comment.id}" } else default_options = { :controller => comment . commentable . class . to_s . underscore . pluralize , :action => :show , :id => ( comment . commentable . is_a? ( Tag ) ? comment . commentable . to_param : comment . commentable . id ) , :anchor => "comment_#{comment.id}" } end redirect_to ( url_for ( default_options . merge ( options ) ) ) else redirect_to_all_comments ( comment . parent , options . merge ( { :show_comments => true , :anchor => "comment_#{comment.id}" } ) ) end end
redirect to a particular comment in a thread, going into the thread
if necessary to display it
redirect to a particular comment in a thread going into the thread if necessary to display it
# display the comment's direct parent (and its associated thread) # need to redirect to the specific chapter; redirect_to_all will then retrieve full work view if applicable
comment
options