Hi guys, I have two tables. Table1: output_columns (3 columns) Table2: file_datas (2 columns) In any table I can search, show, edit data. But how can I insert data in two table? In my input form there are 5 input fields. I want to input 3 data in table1 and last 2 data in table2. In the OutputColumnsController (the controller of table1) I have written the following code def create @output_column = OutputColumn.new(params[:output_column]) if @output_column.save flash[:notice] = ''OutputColumn was successfully created.'' redirect_to :action => ''list'' else render :action => ''new'' end end By this code I can save in the table1. But how can I handle the input data in table2? Plz help me. Amin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ruhul Amin
2007-Apr-17 14:41 UTC
Re: Problem: insert data in two tables from an input form.
Hi guys, I have two tables. Table1: output_columns (3 columns) Table2: file_datas (2 columns) In any table I can search, show, edit data. But how can I insert data in two table? In my input form there are 5 input fields. I want to input 3 data in table1 and last 2 data in table2. In the OutputColumnsController (the controller of table1) I have written the following code def create @output_column = OutputColumn.new(params[:output_column]) if @output_column.save flash[:notice] = ''OutputColumn was successfully created.'' redirect_to :action => ''list'' else render :action => ''new'' end end By this code I can save in the table1. But how can I handle the input data in table2? Plz help me. Amin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---