tags:

views:

42

answers:

1

Hi, I begin learning ruby and rails this week. So I follow some tutorial in the book I found in my school library.

I get to the point where I have main_controller.rb:

class MainController < ApplicationController
  def welcome
    @my_var = 5
  end
end

and for my welcome.html.erb:

<h1>Welcome to the My Application</h1>
We currently have <%= @my_var %> visitors.

but when i run my server, all i got from localhost:3000/main/welcome is:

Welcome to the My Application We currently have visitors.

as if the everything in <%= %> was not executed. and I also try to insert puts 'welcome method is executed' to the main_controller.rb and it does print the line.

So any help? I thank you in advance, Fajarmf

A: 

Try <%=h @my_var %>

Ruby Newbie