# Can't run method on scaffold index

**URL:** <https://www.ruby-forum.com/t/cant-run-method-on-scaffold-index/171787>\
**Category:** Rails\
**Created:** [July 9, 2009, 11:01am UTC](https://www.ruby-forum.com/t/cant-run-method-on-scaffold-index/171787 "2009-07-09T11:01:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![df-sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@df-sean](https://www.ruby-forum.com/u/df-sean)\
**Post date:** [July 9, 2009, 11:01am UTC](https://www.ruby-forum.com/t/cant-run-method-on-scaffold-index/171787/1 "2009-07-09T11:01:18Z")

</div>

I have this method to parse a url:

def parse\_url

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

```

end

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 }
   end
```
