I have the below models UserTable: name email: login: password salt CategoryTable: name [model] has_many :books AutherTable: Name [model] has_many :books PublisherTable: name [model] has_many :books StorageTable: name [model] has_many :books name Book_Table: name isbn description category_id publisher_id auther_id storage_id [model] belongs_to :storage belongs_to :auther belongs_to :publisher belongs_to category My problem is on however to have multiple models in one view. I was able to use form_tag togather data form all models except book. How could I get this resolved is my concern? I know that this is a new bie''s kind of question, but I crave for your understand. Emeka
> My problem is on however to have multiple models in one view. I was > able to use form_tag togather data form all models except book. How > could I get this resolved is my concern? I know that this is a new > bie''s kind of question, but I crave for your understand.You''ll want to look at fields_for. Watch the "Complex Forms" trilogy of Railscasts from a couple years ago. -eric
Have it already but I am still not able to get my head around it. On May 2, 3:57 pm, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > My problem is on however to have multiple models in one view. I was > > able to use form_tag togather data form all models except book. How > > could I get this resolved is my concern? I know that this is a new > > bie''s kind of question, but I crave for your understand. > > You''ll want to look at fields_for. Watch the "Complex Forms" trilogy > of Railscasts from a couple years ago. > > -eric
exactly what are you missing. What is your problem. A form problem is a very broad formulation... regards svend On May 2, 5:45 pm, janus <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Have it already but I am still not able to get my head around it. > > On May 2, 3:57 pm, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > My problem is on however to have multiple models in one view. I was > > > able to use form_tag togather data form all models except book. How > > > could I get this resolved is my concern? I know that this is a new > > > bie''s kind of question, but I crave for your understand. > > > You''ll want to look at fields_for. Watch the "Complex Forms" trilogy > > of Railscasts from a couple years ago. > > > -eric
This is what I am missing, how to include the ids of the models that "has_many" of book model while saving. How to make four ids along with the book data. Regards, Emeka On Sun, May 3, 2009 at 1:43 AM, gundestrup <gundestrup-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > exactly what are you missing. > What is your problem. > A form problem is a very broad formulation... > > regards > svend > > On May 2, 5:45 pm, janus <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Have it already but I am still not able to get my head around it. > > > > On May 2, 3:57 pm, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > My problem is on however to have multiple models in one view. I was > > > > able to use form_tag togather data form all models except book. How > > > > could I get this resolved is my concern? I know that this is a new > > > > bie''s kind of question, but I crave for your understand. > > > > > You''ll want to look at fields_for. Watch the "Complex Forms" trilogy > > > of Railscasts from a couple years ago. > > > > > -eric > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
http://www.onlamp.com/pub/a/onlamp/2007/01/05/revisiting-ruby-on-rails-revisited-2.html read and do this introductions. As you can see, when you create a book, you collect the ids form the other models, and then save them in the book model. On May 3, 1:30 pm, Emeka <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is what I am missing, how to include the ids of the models that > "has_many" of book model while saving. How to make four ids along with the > book data. > > Regards, > Emeka > > On Sun, May 3, 2009 at 1:43 AM, gundestrup <gundest...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > exactly what are you missing. > > What is your problem. > > A form problem is a very broad formulation... > > > regards > > svend > > > On May 2, 5:45 pm, janus <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Have it already but I am still not able to get my head around it. > > > > On May 2, 3:57 pm, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > My problem is on however to have multiple models in one view. I was > > > > > able to use form_tag togather data form all models except book. How > > > > > could I get this resolved is my concern? I know that this is a new > > > > > bie''s kind of question, but I crave for your understand. > > > > > You''ll want to look at fields_for. Watch the "Complex Forms" trilogy > > > > of Railscasts from a couple years ago. > > > > > -eric
if request.post? @author = Author.new(params[:author_name]) @publisher = Publisher.check_this(params[:publisher_name]) @category = Category.check_this(params[:category_name]) @storage = Storage.check_this(params[:storage_name]) end That''s my code for other models and it worked. How do I add @author .... into book class as arguments. Emeka On Sun, May 3, 2009 at 1:40 PM, gundestrup <gundestrup-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > http://www.onlamp.com/pub/a/onlamp/2007/01/05/revisiting-ruby-on-rails-revisited-2.html > > read and do this introductions. > As you can see, when you create a book, you collect the ids form the > other models, and then save them in the book model. > > On May 3, 1:30 pm, Emeka <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > This is what I am missing, how to include the ids of the models that > > "has_many" of book model while saving. How to make four ids along with > the > > book data. > > > > Regards, > > Emeka > > > > On Sun, May 3, 2009 at 1:43 AM, gundestrup <gundest...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > exactly what are you missing. > > > What is your problem. > > > A form problem is a very broad formulation... > > > > > regards > > > svend > > > > > On May 2, 5:45 pm, janus <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Have it already but I am still not able to get my head around it. > > > > > > On May 2, 3:57 pm, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > My problem is on however to have multiple models in one view. I > was > > > > > > able to use form_tag togather data form all models except book. > How > > > > > > could I get this resolved is my concern? I know that this is a > new > > > > > > bie''s kind of question, but I crave for your understand. > > > > > > > You''ll want to look at fields_for. Watch the "Complex Forms" > trilogy > > > > > of Railscasts from a couple years ago. > > > > > > > -eric > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
if request.post? @author = Author.new(params[:author_name]) @publisher = Publisher.check_this(params[:publisher_name]) @category = Category.check_this(params[:category_name]) @storage = Storage.check_this(params[:storage_name]) end That''s my code for other models and it worked. How do I add @author .... into book class as arguments. Emeka On Sun, May 3, 2009 at 1:40 PM, gundestrup <gundestrup-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > http://www.onlamp.com/pub/a/onlamp/2007/01/05/revisiting-ruby-on-rails-revisited-2.html > > read and do this introductions. > As you can see, when you create a book, you collect the ids form the > other models, and then save them in the book model. > > On May 3, 1:30 pm, Emeka <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > This is what I am missing, how to include the ids of the models that > > "has_many" of book model while saving. How to make four ids along with > the > > book data. > > > > Regards, > > Emeka > > > > On Sun, May 3, 2009 at 1:43 AM, gundestrup <gundest...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > exactly what are you missing. > > > What is your problem. > > > A form problem is a very broad formulation... > > > > > regards > > > svend > > > > > On May 2, 5:45 pm, janus <emekami...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Have it already but I am still not able to get my head around it. > > > > > > On May 2, 3:57 pm, Eric <ericgh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > My problem is on however to have multiple models in one view. I > was > > > > > > able to use form_tag togather data form all models except book. > How > > > > > > could I get this resolved is my concern? I know that this is a > new > > > > > > bie''s kind of question, but I crave for your understand. > > > > > > > You''ll want to look at fields_for. Watch the "Complex Forms" > trilogy > > > > > of Railscasts from a couple years ago. > > > > > > > -eric > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---