Hi! I''m new to this group and new to RoR. Because I want to learn RoR I defined a project for myself for learning purposes. So I think this will be my first question of quite a few that will follow. I try to update multipe tables after sending a form. My form is very basic by now and has a title and a short description and a long description. Idea is that there will be multiple description fields later. So the long desc is in another table. I set up all this foreign key, belongs_to and has_many stuff and I''m now able to create a new document in which all data is stored in the right tables. But I''m not able to update it. This is how my update method looks right now: def update @document = Document.find(params[:id]) @text_items = TextItem.find(:all) @text_items.each { |ti| @document.text_items << ti } if @document.update_attributes(params[:document]) flash[:notice] = ''Document was successfully updated.'' redirect_to :action => ''show'', :id => @document else render :action => ''edit'' end end I did not get an error but the data from my text_items will not be saved. I read through my books now multiple times and searched the internet but I did not find a solution. Can somenone please give me a hint? Thanks. Regards, Stefan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Stefanm Stefan Frede wrote:> I try to update multipe tables after sending a form.The easiest way to handle this is to use form_tag instead of form_for. Then in your controller you''ll individually assign values from the params hash to the appropriate model. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sunday 20 January 2008, Stefan Frede wrote:> Can somenone please give me a hint? Thanks.http://railscasts.com/episodes/73 http://railscasts.com/episodes/74 http://railscasts.com/episodes/75 Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks. I don''t understand it completely what happened in the screencasts but I think that is a problem I can solve :) @Bill: Thought that this was what I''ve done but I now think that I know where my further problems were. Will try to get it running this way too. Regards, Stefan On 20 Jan., 19:21, Michael Schuerig <mich...-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org> wrote:> On Sunday 20 January 2008, Stefan Frede wrote: > > > Can somenone please give me a hint? Thanks. > > http://railscasts.com/episodes/73http://railscasts.com/episodes/74http://railscasts.com/episodes/75 > > Michael > > -- > Michael Schuerig > mailto:mich...-q5aiKMLteq5BV9CJdY2HSA@public.gmane.org://www.schuerig.de/michael/--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---