Hod do you call a method to the veiw?

Lets say I did

script/generate controller home

And in the home controller made a the method…

def say
puts “You are here”

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
would work with rails.

2009/9/4 Aaron D. [email protected]:

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/. Also look at
the other guides. The railscast videos are also excellent.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs