[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Rails Tutorial - I'm having a problem

Curt Hibbs

10/11/2004 2:47:00 PM

I'm stuck on step six of the rails tutorial:
http://www.rubyonrails.org/show/Tutor...

After I follow the steps to add phone numbers and update template to display
them, I browse to http://127.0.0.1/frien... and I get the following
error displayed in the browser:

> NameError in Friends#display
> Showing /friends/display.rhtml where line #8 raised uninitialized
constant Person::Phone
> 5: <p>
> 6: <%= @person.name %><br />
> 7:
> 8: <% for phone in @person.phones %>
> 9: <%= phone.phone %><br/>
> 10: <% end %>
> 11:
>
> Show template trace
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-0.9.5/lib/active_record/associat
ions.rb:465:in `phones'
> (erb):8:in `render_template'
>
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-0.8.5/lib/action_view/erb_template
rb:90:in `render_template'
>
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-0.8.5/lib/action_view/abstract_tem
plate.rb:34:in `render_file'
[snip]

Does anyone know why this is, and what I did wrong?

Thanks,
Curt



2 Answers

Kent Sibilev

10/11/2004 3:06:00 PM

0

You have to add

require 'phone'

somewhere, for example to your model/person.rb file.

Cheers,
Kent.

On Oct 11, 2004, at 10:46 AM, Curt Hibbs wrote:

> I'm stuck on step six of the rails tutorial:
> http://www.rubyonrails.org/show/Tutor...
>
> After I follow the steps to add phone numbers and update template to
> display
> them, I browse to http://127.0.0.1/frien... and I get the
> following
> error displayed in the browser:
>
>> NameError in Friends#display
>> Showing /friends/display.rhtml where line #8 raised uninitialized
> constant Person::Phone
>> 5: <p>
>> 6: <%= @person.name %><br />
>> 7:
>> 8: <% for phone in @person.phones %>
>> 9: <%= phone.phone %><br/>
>> 10: <% end %>
>> 11:
>>
>> Show template trace
>>
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-0.9.5/lib/active_record/
> associat
> ions.rb:465:in `phones'
>> (erb):8:in `render_template'
>>
> c:/ruby/lib/ruby/gems/1.8/gems/actionpack-0.8.5/lib/action_view/
> erb_template
> .rb:90:in `render_template'
>>
> c:/ruby/lib/ruby/gems/1.8/gems/actionpack-0.8.5/lib/action_view/
> abstract_tem
> plate.rb:34:in `render_file'
> [snip]
>
> Does anyone know why this is, and what I did wrong?
>
> Thanks,
> Curt
>
>



Curt Hibbs

10/11/2004 4:31:00 PM

0

Kent Sibilev wrote:
>
> You have to add
>
> require 'phone'
>
> somewhere, for example to your model/person.rb file.

Duh!!!

I was just blindly following the tutorial (which I think omitted this).
Thanks! I'll go update the tutorial as well.

Curt


> On Oct 11, 2004, at 10:46 AM, Curt Hibbs wrote:
>
> > I'm stuck on step six of the rails tutorial:
> > http://www.rubyonrails.org/show/Tutor...
> >
> > After I follow the steps to add phone numbers and update template to
> > display
> > them, I browse to http://127.0.0.1/frien... and I get the
> > following
> > error displayed in the browser:
> >
> >> NameError in Friends#display
> >> Showing /friends/display.rhtml where line #8 raised uninitialized
> > constant Person::Phone
> >> 5: <p>
> >> 6: <%= @person.name %><br />
> >> 7:
> >> 8: <% for phone in @person.phones %>
> >> 9: <%= phone.phone %><br/>
> >> 10: <% end %>
> >> 11:
> >>
> >> Show template trace
> >>
> > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-0.9.5/lib/active_record/
> > associat
> > ions.rb:465:in `phones'
> >> (erb):8:in `render_template'
> >>
> > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-0.8.5/lib/action_view/
> > erb_template
> > .rb:90:in `render_template'
> >>
> > c:/ruby/lib/ruby/gems/1.8/gems/actionpack-0.8.5/lib/action_view/
> > abstract_tem
> > plate.rb:34:in `render_file'
> > [snip]
> >
> > Does anyone know why this is, and what I did wrong?
> >
> > Thanks,
> > Curt
> >
> >
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.g...).
> Version: 6.0.775 / Virus Database: 522 - Release Date: 10/8/2004
>