ActiveRecord has_many fails on children

Discussion in 'Ruby' started by inanc, Sep 4, 2006.

  1. inanc

    inanc Guest

    I have two models and they have has_many and belongs_to relationships.
    When I have updated one of the childs of the parent using "
    parent.childs[0].name = 'johny walker' " and called "
    parent.save! "; it does not saves the child rows which I have
    updated; except only the parent.created_at field in the database is
    being updated.

    Should I loop over the child rows and call their save method instead of
    the parent to make the job byself ?

    Regards
     
    inanc, Sep 4, 2006
    #1
    1. Advertising

  2. inanc

    Eric Hodel Guest

    On Sep 3, 2006, at 9:51 PM, inanc wrote:

    > I have two models and they have has_many and belongs_to relationships.
    > When I have updated one of the childs of the parent using "
    > parent.childs[0].name = 'johny walker' " and called "
    > parent.save! "; it does not saves the child rows which I have
    > updated; except only the parent.created_at field in the database is
    > being updated.
    >
    > Should I loop over the child rows and call their save method
    > instead of
    > the parent to make the job byself ?


    You want to ask this question on the Rails list, this list is for
    general ruby questions.

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

    http://trackmap.robotcoop.com
     
    Eric Hodel, Sep 4, 2006
    #2
    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. Replies:
    2
    Views:
    108
    Eero Saynatkari
    Dec 12, 2005
  2. treefrog

    Rails: has_many issue

    treefrog, Feb 6, 2006, in forum: Ruby
    Replies:
    1
    Views:
    164
    Eric Hodel
    Feb 6, 2006
  3. Éric DUMINIL

    ActiveRecord, has_many and _count ...

    Éric DUMINIL, Aug 28, 2006, in forum: Ruby
    Replies:
    3
    Views:
    147
    zdennis
    Aug 29, 2006
  4. Sven S.
    Replies:
    1
    Views:
    123
    Sven S.
    Mar 23, 2010
  5. Replies:
    0
    Views:
    687
Loading...

Share This Page