Hey, i am very new with handling Ruby on Rails, so i did the Video-Tutorial of "video2brain". They use an older Version of Rails (1.8.. - i guess) and in an controller-file they want me to do the following: class FormController < ApplicationController def index @form = Form.find(:first) @form.update_attributes(params[:form]) @detail = @form.detail @detail.update_attributes(params[:detail]) end end But now it says, that the method "detail" (in @details @form.detail) does not exist. I tried to get help with google - but that wasnt succesful. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 22, 4:05 am, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote:> Hey, > > i am very new with handling Ruby on Rails, so i did the Video-Tutorial > of "video2brain". > They use an older Version of Rails (1.8.. - i guess) and in an > controller-file they want me to do the following: > > class FormController < ApplicationController > def index > @form = Form.find(:first) > @form.update_attributes(params[:form]) > > @detail = @form.detail > @detail.update_attributes(params[:detail]) > end > end > > But now it says, that the method "detail" (in @details > @form.detail) does not exist. I tried to get help with google - but > that wasnt succesful.What does your Form model look like? Can you post the code for that? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
@detail = @form.detail should be @detail = @form.details you are missing an s -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
ooooh wait , is a one to one relation chip, do you have belond_to and has one in your models? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 22 Sep., 15:52, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> @detail = @form.detail > > should be > > @detail = @form.details > > you are missing an sI added the S - and so the fault report changed to: undefined method `details'' for #<Form:0x8917af0> (just the S in details is new in this error message). Cant be the Solution -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 22 Sep., 14:58, Tim Shaffer <timshaf...-BUHhN+a2lJ4@public.gmane.org> wrote:> On Sep 22, 4:05 am, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > > > > Hey, > > > i am very new with handling Ruby on Rails, so i did the Video-Tutorial > > of "video2brain". > > They use an older Version of Rails (1.8.. - i guess) and in an > > controller-file they want me to do the following: > > > class FormController < ApplicationController > > def index > > @form = Form.find(:first) > > @form.update_attributes(params[:form]) > > > @detail = @form.detail > > @detail.update_attributes(params[:detail]) > > end > > end > > > But now it says, that the method "detail" (in @details > > @form.detail) does not exist. I tried to get help with google - but > > that wasnt succesful. > > What does your Form model look like? Can you post the code for that?My Form model is an very empty: class Form < ActiveRecord::Base end - I just did what they told me in the "video2brain"- Tutorial. So can you tell me how that Form Model has to look like? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ooooh wait , is a one to one relation chip, do you have > > belond_to and has one in your models?No - i even did not change anything in my model files, because of exactly acting like the "video2brain"-tutorial .. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 08:32, Sven Wildermann <sven_wildermann-LWAfsSFWpa4@public.gmane.org> wrote:> > > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> ooooh wait , is a one to one relation chip, do you have >> >> belond_to and has one in your models? > > > No - i even did not change anything in my model files, because of > exactly acting like the "video2brain"-tutorial ..Is there a table called forms? Is there a ''detail'' field in the forms table? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > > > > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> ooooh wait , is a one to one relation chip, do you have > > >> belond_to and has one in your models? > > > No - i even did not change anything in my model files, because of > > exactly acting like the "video2brain"-tutorial .. > > Is there a table called forms? > Is there a ''detail'' field in the forms table? > > ColinThere is a datebase called "formulare. This database has a table called "forms" and a table called "details" - but there is no detail field in the "forms"-table. So i need to create this field, correct? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Sep., 10:25, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote:> On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > > > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> ooooh wait , is a one to one relation chip, do you have > > > >> belond_to and has one in your models? > > > > No - i even did not change anything in my model files, because of > > > exactly acting like the "video2brain"-tutorial .. > > > Is there a table called forms? > > Is there a ''detail'' field in the forms table? > > > Colin > > There is a datebase called "formulare. > This database has a table called "forms" and a table called "details" > - but there is no detail field in the "forms"-table. > > So i need to create this field, correct?Actually i created the "detail"-field in the forms-table and after pressing F5 i got another fault message: undefined method `update_attributes'' for "":String .. sound like progress ;) ... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 09:25, Sven Wildermann <sven_wildermann-LWAfsSFWpa4@public.gmane.org> wrote:> > > On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: >> >> >> >> > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> ooooh wait , is a one to one relation chip, do you have >> >> >> belond_to and has one in your models? >> >> > No - i even did not change anything in my model files, because of >> > exactly acting like the "video2brain"-tutorial .. >> >> Is there a table called forms? >> Is there a ''detail'' field in the forms table? >> >> Colin > > There is a datebase called "formulare. > This database has a table called "forms" and a table called "details" > - but there is no detail field in the "forms"-table. > > So i need to create this field, correct?No, I think it is more likely that you need to setup a relationship between the tables so that form has_many details. This should all be in the tutorial however. I think you might be much better finding a tutorial for the version of rails you are using however. If it is out of date you will forever be coming up against problems. I would start by looking at the Rails Guides (google it) and http://railstutorial.org/ is good. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Sep., 10:36, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 September 2010 09:25, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > > > > > > On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > >> > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> ooooh wait , is a one to one relation chip, do you have > > >> >> belond_to and has one in your models? > > >> > No - i even did not change anything in my model files, because of > >> > exactly acting like the "video2brain"-tutorial .. > > >> Is there a table called forms? > >> Is there a ''detail'' field in the forms table? > > >> Colin > > > There is a datebase called "formulare. > > This database has a table called "forms" and a table called "details" > > - but there is no detail field in the "forms"-table. > > > So i need to create this field, correct? > > No, I think it is more likely that you need to setup a relationship > between the tables so that form has_many details. This should all be > in the tutorial however. > > I think you might be much better finding a tutorial for the version of > rails you are using however. If it is out of date you will forever be > coming up against problems. > > I would start by looking at the Rails Guides (google it) andhttp://railstutorial.org/is good. > > ColinThanks for that advice. But i really want to finish this chapter of the tutorial - So could you (or someone else) tell me, why this error message appears and what i need to do to go on? - Thank you very much for your help ! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 09:42, Sven Wildermann <sven_wildermann-LWAfsSFWpa4@public.gmane.org> wrote:> > > On 23 Sep., 10:36, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 23 September 2010 09:25, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: >> >> >> >> >> >> > On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: >> >> >> > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> ooooh wait , is a one to one relation chip, do you have >> >> >> >> belond_to and has one in your models? >> >> >> > No - i even did not change anything in my model files, because of >> >> > exactly acting like the "video2brain"-tutorial .. >> >> >> Is there a table called forms? >> >> Is there a ''detail'' field in the forms table? >> >> >> Colin >> >> > There is a datebase called "formulare. >> > This database has a table called "forms" and a table called "details" >> > - but there is no detail field in the "forms"-table. >> >> > So i need to create this field, correct? >> >> No, I think it is more likely that you need to setup a relationship >> between the tables so that form has_many details. This should all be >> in the tutorial however. >> >> I think you might be much better finding a tutorial for the version of >> rails you are using however. If it is out of date you will forever be >> coming up against problems. >> >> I would start by looking at the Rails Guides (google it) andhttp://railstutorial.org/is good. >> >> Colin > > Thanks for that advice. But i really want to finish this chapter of > the tutorial - > So could you (or someone else) tell me, why this error message appears > and what i need to do to go on?As I said I think it is likely that you should have setup a relationship between the models. You may have missed something in the tutorial (or the tutorial is missing details). Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Sep., 11:26, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 September 2010 09:42, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > > > > > > On 23 Sep., 10:36, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 23 September 2010 09:25, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > >> > On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> >> On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...@yahoo.de> wrote: > > >> >> > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> >> ooooh wait , is a one to one relation chip, do you have > > >> >> >> belond_to and has one in your models? > > >> >> > No - i even did not change anything in my model files, because of > >> >> > exactly acting like the "video2brain"-tutorial .. > > >> >> Is there a table called forms? > >> >> Is there a ''detail'' field in the forms table? > > >> >> Colin > > >> > There is a datebase called "formulare. > >> > This database has a table called "forms" and a table called "details" > >> > - but there is no detail field in the "forms"-table. > > >> > So i need to create this field, correct? > > >> No, I think it is more likely that you need to setup a relationship > >> between the tables so that form has_many details. This should all be > >> in the tutorial however. > > >> I think you might be much better finding a tutorial for the version of > >> rails you are using however. If it is out of date you will forever be > >> coming up against problems. > > >> I would start by looking at the Rails Guides (google it) andhttp://railstutorial.org/isgood. > > >> Colin > > > Thanks for that advice. But i really want to finish this chapter of > > the tutorial - > > So could you (or someone else) tell me, why this error message appears > > and what i need to do to go on? > > As I said I think it is likely that you should have setup a > relationship between the models. You may have missed something in the > tutorial (or the tutorial is missing details). > > Colin.. The tutorial is missind details - F***! Maybe you could explain to me how to setup a relationship between the models? Otherwise i will google or do an other tutorial... Thank you so far -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 10:52, Sven Wildermann <sven_wildermann-LWAfsSFWpa4@public.gmane.org> wrote:> > > On 23 Sep., 11:26, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 23 September 2010 09:42, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: >> >> >> >> >> >> > On 23 Sep., 10:36, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 23 September 2010 09:25, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: >> >> >> > On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> >> On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...@yahoo.de> wrote: >> >> >> >> > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> >> ooooh wait , is a one to one relation chip, do you have >> >> >> >> >> belond_to and has one in your models? >> >> >> >> > No - i even did not change anything in my model files, because of >> >> >> > exactly acting like the "video2brain"-tutorial .. >> >> >> >> Is there a table called forms? >> >> >> Is there a ''detail'' field in the forms table? >> >> >> >> Colin >> >> >> > There is a datebase called "formulare. >> >> > This database has a table called "forms" and a table called "details" >> >> > - but there is no detail field in the "forms"-table. >> >> >> > So i need to create this field, correct? >> >> >> No, I think it is more likely that you need to setup a relationship >> >> between the tables so that form has_many details. This should all be >> >> in the tutorial however. >> >> >> I think you might be much better finding a tutorial for the version of >> >> rails you are using however. If it is out of date you will forever be >> >> coming up against problems. >> >> >> I would start by looking at the Rails Guides (google it) andhttp://railstutorial.org/isgood. >> >> >> Colin >> >> > Thanks for that advice. But i really want to finish this chapter of >> > the tutorial - >> > So could you (or someone else) tell me, why this error message appears >> > and what i need to do to go on? >> >> As I said I think it is likely that you should have setup a >> relationship between the models. You may have missed something in the >> tutorial (or the tutorial is missing details). >> >> Colin > > .. The tutorial is missind details - F***! > > Maybe you could explain to me how to setup a relationship between the > models? Otherwise i will google or do an other tutorial... > Thank you so farThat is what I suggested in the first place, to quote myself:>> >> I would start by looking at the Rails Guides (google it) and http://railstutorial.org/ is good.I would suggest that you use Rails 3 if you are not already doing so as it is now the current version, though it is still very new, so those who will try to help you are still learning themselves. There is a Rails Guide specifically on ActiveRecord Relationships but I would start with Getting Started. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Sep., 12:02, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 September 2010 10:52, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > > > > > > On 23 Sep., 11:26, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 23 September 2010 09:42, Sven Wildermann <sven_wilderm...-LWAfsSFWpa4@public.gmane.org> wrote: > > >> > On 23 Sep., 10:36, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> >> On 23 September 2010 09:25, Sven Wildermann <sven_wilderm...@yahoo.de> wrote: > > >> >> > On 23 Sep., 10:00, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> >> >> On 23 September 2010 08:32, Sven Wildermann <sven_wilderm...@yahoo.de> wrote: > > >> >> >> > On 22 Sep., 15:53, radhames brito <rbri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> >> >> ooooh wait , is a one to one relation chip, do you have > > >> >> >> >> belond_to and has one in your models? > > >> >> >> > No - i even did not change anything in my model files, because of > >> >> >> > exactly acting like the "video2brain"-tutorial .. > > >> >> >> Is there a table called forms? > >> >> >> Is there a ''detail'' field in the forms table? > > >> >> >> Colin > > >> >> > There is a datebase called "formulare. > >> >> > This database has a table called "forms" and a table called "details" > >> >> > - but there is no detail field in the "forms"-table. > > >> >> > So i need to create this field, correct? > > >> >> No, I think it is more likely that you need to setup a relationship > >> >> between the tables so that form has_many details. This should all be > >> >> in the tutorial however. > > >> >> I think you might be much better finding a tutorial for the version of > >> >> rails you are using however. If it is out of date you will forever be > >> >> coming up against problems. > > >> >> I would start by looking at the Rails Guides (google it) andhttp://railstutorial.org/isgood. > > >> >> Colin > > >> > Thanks for that advice. But i really want to finish this chapter of > >> > the tutorial - > >> > So could you (or someone else) tell me, why this error message appears > >> > and what i need to do to go on? > > >> As I said I think it is likely that you should have setup a > >> relationship between the models. You may have missed something in the > >> tutorial (or the tutorial is missing details). > > >> Colin > > > .. The tutorial is missind details - F***! > > > Maybe you could explain to me how to setup a relationship between the > > models? Otherwise i will google or do an other tutorial... > > Thank you so far > > That is what I suggested in the first place, to quote myself: > > >> >> I would start by looking at the Rails Guides (google it) andhttp://railstutorial.org/is good. > > I would suggest that you use Rails 3 if you are not already doing so > as it is now the current version, though it is still very new, so > those who will try to help you are still learning themselves. > There is a Rails Guide specifically on ActiveRecord Relationships but > I would start with Getting Started. > > ColinI dont use Rail 3, but 1.8.6 - because the Autor of the Tutorial used that Version, too. Would you recommend to use the 2. or the 3. Version? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sven Wildermann wrote:> class FormController < ApplicationController > def index > @form = Form.find(:first) > @form.update_attributes(params[:form]) > > @detail = @form.detail > @detail.update_attributes(params[:detail]) > end > end >IIRC, given the code above as the main clue, you might need: class form < ActiveRecord::Base # a form model has a related detail model has_one :detail end class detail < ActiveRecord::Base # and vice-versa belongs_to :form end The details table needs to have a column named form_id, spec''ed as integer, the forms table gets no additional field. If there can be more than one detail model related to a form, then just the form model specification changes... it notes has_many, and the related model is pluralized. class form < ActiveRecord::Base # a form model has a related detail model has_many :details end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sven Wildermann wrote:> On 23 Sep., 10:36, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> >> ooooh wait , is a one to one relation chip, do you have >> >> I think you might be much better finding a tutorial for the version of >> rails you are using however. �If it is out of date you will forever be >> coming up against problems. >> >> I would start by looking at the Rails Guides (google it) andhttp://railstutorial.org/is good. >> >> Colin > > Thanks for that advice. But i really want to finish this chapter of > the tutorial -Don''t bother. If it''s out of date, just drop it and find a current tutorial. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 September 2010 14:48, Sven Wildermann <sven_wildermann-LWAfsSFWpa4@public.gmane.org> wrote:> > On 23 Sep., 12:02, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> ... >> I would suggest that you use Rails 3 if you are not already doing so >> as it is now the current version, though it is still very new, so >> those who will try to help you are still learning themselves. >> There is a Rails Guide specifically on ActiveRecord Relationships but >> I would start with Getting Started. >> > > I dont use Rail 3, but 1.8.6 - because the Autor of the Tutorial used > that Version, too. > Would you recommend to use the 2. or the 3. Version?I think I answered that already. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote:> On 23 September 2010 14:48, Sven Wildermann <sven_wildermann-LWAfsSFWpa4@public.gmane.org> > wrote: >> I dont use Rail 3, but 1.8.6 - because the Autor of the Tutorial used >> that Version, too.Oh, hold on a minute. Rails 1.8.6 doesn''t exist; that looks like a Ruby version number. So...what version of Rails does the tutorial *actually* use?>> Would you recommend to use the 2. or the 3. Version? > > I think I answered that already. > > ColinBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Sep., 16:25, Ar Chron <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Sven Wildermann wrote: > > class FormController < ApplicationController > > def index > > @form = Form.find(:first) > > @form.update_attributes(params[:form]) > > > @detail = @form.detail > > @detail.update_attributes(params[:detail]) > > end > > end > > IIRC, given the code above as the main clue, you might need: > > class form < ActiveRecord::Base > # a form model has a related detail model > has_one :detail > end > > class detail < ActiveRecord::Base > # and vice-versa > belongs_to :form > end > > The details table needs to have a column named form_id, spec''ed as > integer, the forms table gets no additional field. > > If there can be more than one detail model related to a form, then just > the form model specification changes... it notes has_many, and the > related model is pluralized. > > class form < ActiveRecord::Base > # a form model has a related detail model > has_many :details > end > > -- > Posted viahttp://www.ruby-forum.com/.Thanks! That was almost successful ..I used the "has_one" -command and deleted the following line in form_controller.rb: "@detail.update_attributes(params[:detail])". Actually i can see two boxes - the second one is the "detail"-box. the first one saves my changes. the detail-box does not. Pasting the "@detail.update_attributes(params[:detail])" -line into the form_controller.rb , the following error message appears: " NoMethodError in FormController#index You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occured while evaluating nil.update_attributes" Whats wrong? And Thank you very very very (!) much for your help - thats awesome to get help by friendly people :] -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sven Wildermann wrote:> You have a nil object when you didn''t expect it! > You might have expected an instance of ActiveRecord::Base. > The error occured while evaluating nil.update_attributes" >Can you show the POST from your log file... I''d like to see what your params hash looks like. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 Sep., 20:28, Ar Chron <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Sven Wildermann wrote: > > You have a nil object when you didn''t expect it! > > You might have expected an instance of ActiveRecord::Base. > > The error occured while evaluating nil.update_attributes" > > Can you show the POST from your log file... I''d like to see what your > params hash looks like. > -- > Posted viahttp://www.ruby-forum.com/.Hey (especially to Ar Chron), i just get an POST in my log file, if there is no fault message in the beginning (i guess that makes sense). Therefore i deleted the ""@detail.update_attributes(params[:detail])" line in form_controller.rb, wrote a short text in both boxes and pressed "Speichern" (> the German word for "Submit"). At least i got the following post in my log file: Processing FormController#index (for 127.0.0.1 at 2010-09-24 09:11:59) [POST] Session ID: 7d9c4ddeaff0f55ddf9356003f9a1750 Parameters: {"commit"=>"Speichern", "action"=>"index", "controller"=>"form", "form"=>{"kurztext"=>"This is a test for the talk"}, "detail"=>{"detailtext"=>"Test for the talk"}} [4;35;1mForm Load (0.000000) [0m [0mSELECT * FROM forms LIMIT 1 [0m [4;36;1mForm Columns (0.000000) [0m [0;1mSHOW FIELDS FROM forms [0m [4;35;1mSQL (0.000000) [0m [0mBEGIN [0m [4;36;1mForm Update (0.031000) [0m [0;1mUPDATE forms SET `checkbox` = 0, `detail` = '''', `auswahlbuttons` = ''Nein'', `kurztext` ''This is a test for the talk'', `datum` = ''2008-06-01'', `detailtext` '''', `auswahl` = ''RoR'', `langtext` = ''Mein Langtext...'' WHERE id 1 [0m [4;35;1mSQL (0.016000) [0m [0mCOMMIT [0m [4;36;1mDetail Load (0.000000) [0m [0;1mSELECT * FROM details WHERE (details.form_id = 1) LIMIT 1 [0m Rendering form/index Completed in 0.06300 (15 reqs/sec) | Rendering: 0.01600 (25%) | DB: 0.04700 (74%) | 200 OK [http://localhost/form] Thanks for your help (in hope of advance) -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
From earlier in the post-stream: class FormController < ApplicationController def index @form = Form.find(:first) @form.update_attributes(params[:form]) @detail = @form.detail @detail.update_attributes(params[:detail]) end end From your log: {"commit"=>"Speichern", "action"=>"index", "controller"=>"form", "form"=>{"kurztext"=>"This is a test for the talk"}, "detail"=>{"detailtext"=>"Test for the talk"}} Something is truly bizarre with this example you are trying to follow... and I can''t say that I fathom the intent of the example in the tutorial. So I went to look, and found a PDF about Rails at video2brain, but unfortunately, Ich spreche kein Deutsches. Strange issues with this example: You generally don''t POST to the index method... that''s usually a GET. This code will always be modifying the first form due to the Form.find(:first) statement... perhaps there is only supposed to be one. The detail model in params doesn''t contain a form_id. You could remedy that by: @form = Form.find(:first) @form.update_attributes(params[:form]) if @form.detail @detail = @form.detail else @detail = Detail.new end @detail.form_id = @form.id @detail.update_attributes(params[:detail]) That should at least get you a value for form_id in the detail model (you did add form_id as integer to your details table, no?)) But this example is "wrong" in so many ways. Finish it if you must, then promptly forget this video2brain... gibberish. Step up to Rails3, and find a couple of Rails 3 tutorials. You''ll be much better served spending your time on those. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ar Chron wrote:> From earlier in the post-stream: > > class FormController < ApplicationController > def index > @form = Form.find(:first) > @form.update_attributes(params[:form]) > > @detail = @form.detail > @detail.update_attributes(params[:detail]) > end > end > > From your log: > > {"commit"=>"Speichern", "action"=>"index", > "controller"=>"form", "form"=>{"kurztext"=>"This is a test for the > talk"}, "detail"=>{"detailtext"=>"Test for the talk"}} > > > Something is truly bizarre with this example you are trying > to follow... and I can''t say that I fathom the intent of > the example in the tutorial. So I went to look, and found a > PDF about Rails at video2brain, but unfortunately, Ich spreche > kein Deutsches.Hast du ein URL? I can read German (though I''ve never used Rails 3)... Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser wrote:> > Hast du ein URL? I can read German (though I''ve never used Rails 3)... >Hi Marnen, I was trying to get an idea of the lesson by browsing the "course contents" in this pdf: www.video2brain.com/de/pdf-toc-60.pdf -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 24 Sep., 19:29, Ar Chron <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> From earlier in the post-stream: > > class FormController < ApplicationController > def index > @form = Form.find(:first) > @form.update_attributes(params[:form]) > > @detail = @form.detail > @detail.update_attributes(params[:detail]) > end > end > > From your log: > > {"commit"=>"Speichern", "action"=>"index", > "controller"=>"form", "form"=>{"kurztext"=>"This is a test for the > talk"}, "detail"=>{"detailtext"=>"Test for the talk"}} > > Something is truly bizarre with this example you are trying > to follow... and I can''t say that I fathom the intent of > the example in the tutorial. So I went to look, and found a > PDF about Rails at video2brain, but unfortunately, Ich spreche > kein Deutsches. > > Strange issues with this example: > > You generally don''t POST to the index method... that''s > usually a GET. > > This code will always be modifying the first form due to the > Form.find(:first) statement... perhaps there is only supposed to > be one. > > The detail model in params doesn''t contain a form_id. You could > remedy that by: > > @form = Form.find(:first) > @form.update_attributes(params[:form]) > > if @form.detail > @detail = @form.detail > else > @detail = Detail.new > end > > @detail.form_id = @form.id > @detail.update_attributes(params[:detail]) > > That should at least get you a value for form_id in > the detail model (you did add form_id as integer to your > details table, no?)) > > But this example is "wrong" in so many ways. Finish it if you must, > then promptly forget this video2brain... gibberish. > > Step up to Rails3, and find a couple of Rails 3 tutorials. You''ll be > much better served spending your time on those. > -- > Posted viahttp://www.ruby-forum.com/.Thank you very much, everybody - it works! @ marnen Laibow-Koser: einen URL wofür? Das Video2Brain-Tutorial ist nur käuflich erhältlich. regards, Sven -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.