# First day on rails...and already hamstrung!

**URL:** <https://www.ruby-forum.com/t/first-day-on-rails-and-already-hamstrung/168259>\
**Category:** Rails\
**Created:** [May 18, 2009, 8:45pm UTC](https://www.ruby-forum.com/t/first-day-on-rails-and-already-hamstrung/168259 "2009-05-18T20:45:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 18, 2009, 8:45pm UTC](https://www.ruby-forum.com/t/first-day-on-rails-and-already-hamstrung/168259/1 "2009-05-18T20:45:08Z")

</div>

I’m reading along with “Ajax on Rails” (2007) and the first exercise  
goes like this:

rails example  
cd example  
script/generate controller chap2 myaction  
script/server

Then editing example/app/views/myaction.html.erb to look like this:

## Hello World?

Firebug then says fone() is not defined. In the book the script is  
after the html but this does not matter.

What’s the deal? I have not tried src’ing an external script (as I am  
not sure where I would put that). I can’t really proceed if the js in  
the view is just going to be ignored. I also added the  
language=“javascript”, as this seems to be necessary sometimes in normal  
html pages, but this does not help.

---

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 18, 2009, 9:01pm UTC](https://www.ruby-forum.com/t/first-day-on-rails-and-already-hamstrung/168259/2 "2009-05-18T21:01:57Z")

</div>

On Mon, May 18, 2009 at 11:45 AM, Mk 27  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m reading along with “Ajax on Rails” (2007)

a bit old, but …

> and the first exercise goes like this:

> Then editing example/app/views/myaction.html.erb to look like this:

> What’s the deal? I have not tried src’ing an external script (as I am  
> not sure where I would put that). I can’t really proceed if the js in  
> the view is just going to be ignored. I also added the  
> language=“javascript”, as this seems to be necessary sometimes in normal  
> html pages, but this does not help.

1. the language attribute is not only not “necessary”, it’s deprecated;  
don’t use it.

2. spell text/javascript correctly and it should work as intended.

## HTH,

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![mk27](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5e9695/32.png) [@mk27](https://www.ruby-forum.com/u/mk27)\
**Post date:** [May 18, 2009, 9:06pm UTC](https://www.ruby-forum.com/t/first-day-on-rails-and-already-hamstrung/168259/3 "2009-05-18T21:06:34Z")

</div>

Hassan S. wrote:

> 1. the language attribute is not only not “necessary”, it’s deprecated;  
> don’t use it.

Thanks.

> 1. spell text/javascript correctly and it should work as intended.

Sheesh. New things make me crazy paranoid.
