[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

[RoR] problems using own class

Jonathan Heinen

7/20/2006 1:56:00 AM

Hi,

I just build my own class that looks like this


class Rechnungsdaten
attr_accessor :nummer
end


I saved this file as "rechnungsdaten.rb" in the models folder.
When I use this code:


@rechnung = Rechnungsdaten.new
@rechnung.nummer = @rechnungsnummer


I get this error message in my browser:


undefined method `nummer=' for #<Rechnungsdaten:0x3976148>


How could this be? I can't understand that! Or do I have to include the
class by using requieres? .... But why doesn't rails say me that it
can't find >> Rechnungsdaten <<?

Jonathan


4 Answers

Eric Hodel

7/20/2006 4:58:00 AM

0

On Jul 19, 2006, at 7:00 PM, Jonathan Heinen wrote:

> How could this be? I can't understand that! Or do I have to include
> the class by using requieres? .... But why doesn't rails say me
> that it can't find >> Rechnungsdaten <<?

Rails questions go on the Rails mailing list.

http://lists.rubyonrails.org/mailman/list...

--
Eric Hodel - drbrain@segment7.net - http://blog.se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...



Jonathan Heinen

7/20/2006 1:55:00 PM

0

Hi,

I solved this problem with the help of a german RoR forum.

The problem is that you have to reload the server when you made changes
in the source!
But you also can add

include Reloadable

to your class so it will be reloaded automaticly!

Jonathan


Jonathan Heinen schrieb:
> Hi,
>
> I just build my own class that looks like this
>
>
> class Rechnungsdaten
> attr_accessor :nummer
> end
>
>
> I saved this file as "rechnungsdaten.rb" in the models folder.
> When I use this code:
>
>
> @rechnung = Rechnungsdaten.new
> @rechnung.nummer = @rechnungsnummer
>
>
> I get this error message in my browser:
>
>
> undefined method `nummer=' for #<Rechnungsdaten:0x3976148>
>
>
> How could this be? I can't understand that! Or do I have to include the
> class by using requieres? .... But why doesn't rails say me that it
> can't find >> Rechnungsdaten <<?
>
> Jonathan
>
>

Guest

7/20/2006 2:53:00 PM

0

Jonathan Heinen wrote:
> I solved this problem with the help of a german RoR forum.
www.rubyforen.de is a german Ruby forum not (only) a RoR forum! ;)

Jonathan Heinen

7/21/2006 1:48:00 AM

0

Hi Jan,

a little bit foolish but ...

Jan Friedrich schrieb:
> > I solved this problem with the help of a german RoR forum.
> www.rubyforen.de is a german Ruby forum not (only) a RoR forum! ;)

rubyforen es the german plural for forum so it's forums the page is
called rubyforums. The page has this name because there are a lot of
forums there and one, the one I refere to is the RoR forum =)


So jetzt habe ich mich zumindest als Deutscher geoutet und die native
englisch Sprecher wissen jetzt auch wieso mein Englisch so scheisse ist =)

Jonathan