[RoR] problems using own class

Discussion in 'Ruby' started by Jonathan Heinen, Jul 20, 2006.

  1. 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
     
    Jonathan Heinen, Jul 20, 2006
    #1
    1. Advertising

  2. Jonathan Heinen

    Eric Hodel Guest

    Eric Hodel, Jul 20, 2006
    #2
    1. Advertising

  3. 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
    >
    >
     
    Jonathan Heinen, Jul 20, 2006
    #3
  4. 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! ;)
     
    Jan Friedrich, Jul 20, 2006
    #4
  5. 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
     
    Jonathan Heinen, Jul 21, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Siegl
    Replies:
    1
    Views:
    776
  2. Saverio M.
    Replies:
    0
    Views:
    521
    Saverio M.
    Jul 3, 2006
  3. dc
    Replies:
    2
    Views:
    110
    Jonas Hartmann
    Sep 19, 2006
  4. Joachim Reichel
    Replies:
    4
    Views:
    86
    Joachim Reichel
    Jun 9, 2007
  5. David Filmer
    Replies:
    17
    Views:
    269
    J. Romano
    Aug 18, 2004
Loading...

Share This Page