class BlogPostsController < ApplicationController

  @@post_root = 'blog content/master/Posts'

  def index
    @dir_to_list = @@post_root
    @context = 'posts'
  end

  def topic
    @dir_to_list = "#{@@post_root}/#{params[:topic]}"
    @context = params[:topic]
  end

  def subcontent
    @content_root = "#{@@post_root}/#{params[:topic]}/#{params[:subcontent]}"
    @context = params[:subcontent]
  end

  def post
    @content_root = "#{@@post_root}/#{params[:topic]}/#{params[:subtopic]}/#{params[:post]}"
  end
end

class BlogPostsController < ApplicationController
  def initialize
    @post_root = 'blog content/master/Posts'
  end

  def index
    @dir_to_list = @post_root
    @context = 'posts'
  end

  def topic
    @dir_to_list = "#{@post_root}/#{params[:topic]}"
    @context = params[:topic]
  end

  def subcontent
    @content_root = "#{@post_root}/#{params[:topic]}/#{params[:subcontent]}"
    @context = params[:subcontent]
  end

  def post
    @content_root = "#{@post_root}/#{params[:topic]}/#{params[:subtopic]}/#{params[:post]}"
  end
end

Change post_root into instance variable
Change post_root into instance variable

This is the ideomatic ruby way to achive this result, and as such it
will be used.
