# Hod do you call a method to the veiw?

**URL:** <https://www.ruby-forum.com/t/hod-do-you-call-a-method-to-the-veiw/174931>\
**Category:** Rails\
**Created:** [September 4, 2009, 10:16am UTC](https://www.ruby-forum.com/t/hod-do-you-call-a-method-to-the-veiw/174931 "2009-09-04T10:16:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adsouzp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/df788c/32.png) [@adsouzp](https://www.ruby-forum.com/u/adsouzp)\
**Post date:** [September 4, 2009, 10:16am UTC](https://www.ruby-forum.com/t/hod-do-you-call-a-method-to-the-veiw/174931/1 "2009-09-04T10:16:16Z")

</div>

Lets say I did

script/generate controller home

And in the home controller made a the method…

def say  
puts “You are here”  
end

How would I call that method in the index.html.erb?

When learning ruby it just said to run the whatever.rb in the terminal  
to run what ever code you wrote within that file. Just curious on how  
that  
would work with rails.

---

<div class="post-metadata">

**Author:** ![adsouzp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/df788c/32.png) [@adsouzp](https://www.ruby-forum.com/u/adsouzp)\
**Post date:** [September 4, 2009, 10:37am UTC](https://www.ruby-forum.com/t/hod-do-you-call-a-method-to-the-veiw/174931/2 "2009-09-04T10:37:54Z")

</div>

2009/9/4 Aaron D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> How would I call that method in the index.html.erb?

What do you mean by calling a method of the controller from a view?  
Controller methods are generally actions that map to urls so you would  
link to the action in the view, so the user invokes that action when  
he clicks the link.

If you have not already done so I would recommend working through the  
Getting Started guide at [http://guides.rubyonrails.org/](http://guides.rubyonrails.org/). Also look at  
the other guides. The railscast videos are also excellent.

Colin
