Can't run method on scaffold index

I have this method to parse a url:

def parse_url

       elements = @article.url.split("/")
     if(elements[0] == "http:")
    @home = elements[2]
    @home = elements[0]

In the show method I can just use @home = parse_url and it works. In
the index I don't know how to assign the proper id.
This is the index method:

def index

    @articles = Article.paginate :page => params[:page], :per_page => 3

    respond_to do |format|
      format.html # index.html.erb
      format.xml { render :xml => @articles }