# Newbie hitting a wall on first project, help, please!

**URL:** <https://www.ruby-forum.com/t/newbie-hitting-a-wall-on-first-project-help-please/52541>\
**Category:** Rails\
**Created:** [January 16, 2006, 6:44am UTC](https://www.ruby-forum.com/t/newbie-hitting-a-wall-on-first-project-help-please/52541 "2006-01-16T06:44:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lindsay\_donaghe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5e9695/32.png) [@lindsay\_donaghe](https://www.ruby-forum.com/u/lindsay_donaghe)\
**Post date:** [January 16, 2006, 6:44am UTC](https://www.ruby-forum.com/t/newbie-hitting-a-wall-on-first-project-help-please/52541/1 "2006-01-16T06:44:03Z")

</div>

Hi Ruby and Rails gurus,

I am not a newbie to programming but am only a day’s worth of learning  
into Ruby and Rails. Starting out with the Agile Web D. with  
Rails book…

I did the first project fine, generated a controller (Say) with a method  
(Hello) and an rhtml file (hello.rhtml) and everything works as expected  
until I try to add a local variable and access it from the rhtml file…  
What am I doing wrong?

The controller code:  
class SayController \< ApplicationController  
def Hello  
@time = Time.now  
end  
end

The hello.rhtml code:

Hello World! Hello World! the time is \<%= @time %\>

The output:  
Hello World! the time is

There’s no “time”…

I have recreated the project 3 times with the same results. I thought  
maybe there was something wrong with my install so I unstalled ruby,  
reinstalled it, did the update on it and rails, ran again, same  
results…

Does anyone have any idea what I’m doing wrong? The code looks just  
like the book (other than the plain text in the rhtml file) and I’m not  
doing anything fancy…

I would really appreciate some help. Ruby and Rails look extremely  
interesting and I don’t want to abandon it because of something stupid  
that I can’t get the simplest thing to work.

Thanks much!  
Lindsay

---

<div class="post-metadata">

**Author:** ![lindsay\_donaghe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5e9695/32.png) [@lindsay\_donaghe](https://www.ruby-forum.com/u/lindsay_donaghe)\
**Post date:** [January 16, 2006, 6:46am UTC](https://www.ruby-forum.com/t/newbie-hitting-a-wall-on-first-project-help-please/52541/2 "2006-01-16T06:46:03Z")

</div>

I forgot to mention, this code works fine too:

Hello World! Hello World! the time is \<%= Time.now %\>

It’s just when I try to use the @time variable from the controller that  
it doesn’t work…

Thanks.

---

<div class="post-metadata">

**Author:** ![lindsay\_donaghe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5e9695/32.png) [@lindsay\_donaghe](https://www.ruby-forum.com/u/lindsay_donaghe)\
**Post date:** [January 16, 2006, 6:49am UTC](https://www.ruby-forum.com/t/newbie-hitting-a-wall-on-first-project-help-please/52541/3 "2006-01-16T06:49:31Z")

</div>

The action name in the controller should be lower case ‘hello’:

```
def hello
	@time = Time.now
end

```

If an action can’t be found, the view (hello.rhtml) is executed by  
default.

---

<div class="post-metadata">

**Author:** ![lindsay\_donaghe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5e9695/32.png) [@lindsay\_donaghe](https://www.ruby-forum.com/u/lindsay_donaghe)\
**Post date:** [January 16, 2006, 7:02am UTC](https://www.ruby-forum.com/t/newbie-hitting-a-wall-on-first-project-help-please/52541/4 "2006-01-16T07:02:02Z")

</div>

Thank you… what a stupid oversight!!! Geeze… That’s what you get  
for copying and pasting and staying up too late staring at things.

Thanks again.
