question one: is there any select box tag for form_for? now,perhaps i just can use the select or select_tag? question tow: i have a A model,it has one B such as: class A< ActiveRecord::Base belongs_to :B when i use the form_for tag,how can i output the variable name?like this: <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> <%=f.text_area "b[name]"%> ........ <%end%> it doesnt work. thanks 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-/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://api.rubyonrails.org/ is the best resource for queries like these. The answer to your question is a yes, just browse through the documentation to figure it out. On Apr 6, 4:08 pm, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> question one: > > is there any select box tag for form_for? > > now,perhaps i just can use the select or select_tag? > > question tow: > > i have a A model,it has one B such as: > > class A< ActiveRecord::Base > belongs_to :B > > when i use the form_for tag,how can i output the variable name?like > this: > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > <%=f.text_area "b[name]"%> > ........ > <%end%> > > it doesnt work. > > thanks 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-/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,i have the api source,and i have searched it.i have not found the solution. pls show me some details,thanks for your help. On Apr 6, 8:41 pm, Mukund <marut...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> http://api.rubyonrails.org/ is the best resource for queries like > these. The answer to your question is a yes, just browse through the > documentation to figure it out. > > On Apr 6, 4:08 pm, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > question one: > > > is there any select box tag for form_for? > > > now,perhaps i just can use the select or select_tag? > > > question tow: > > > i have a A model,it has one B such as: > > > class A< ActiveRecord::Base > > belongs_to :B > > > when i use the form_for tag,how can i output the variable name?like > > this: > > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > > <%=f.text_area "b[name]"%> > > ........ > > <%end%> > > > it doesnt work. > > > thanks for your help!- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6 Apr 2008, at 12:08, Vincent.Z wrote:> > question one: > > is there any select box tag for form_for?Like f.select (assuming f is your form builder?)> > > now,perhaps i just can use the select or select_tag? > > > question tow: > > i have a A model,it has one B such as: > > class A< ActiveRecord::Base > belongs_to :B > > > when i use the form_for tag,how can i output the variable name?like > this: > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > <%=f.text_area "b[name]"%> > ........ > <%end%> >You''re trying to display a.b.name ? If so you could either drop down a level and use text_area_tag, or use fields_for to create a scope around b (and then you can just do other_f.text_area :name) Fred --~--~---------~--~----~------------~-------~--~----~ 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! :) On Apr 6, 10:25 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 6 Apr 2008, at 12:08, Vincent.Z wrote: > > > > > question one: > > > is there any select box tag for form_for? > > Like f.select (assuming f is your form builder?) > > > > > > > > > now,perhaps i just can use the select or select_tag? > > > question tow: > > > i have a A model,it has one B such as: > > > class A< ActiveRecord::Base > > belongs_to :B > > > when i use the form_for tag,how can i output the variable name?like > > this: > > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > > <%=f.text_area "b[name]"%> > > ........ > > <%end%> > > You''re trying to display a.b.name ? If so you could either drop down a > level and use text_area_tag, or use fields_for to create a scope > around b (and then you can just do other_f.text_area :name) > > Fred- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i wanna set up a blank text area for b.name,i dont wanna display something. when i code : <%fields_for :b,@a.b do |b|%> there is one error as follows: You have a nil object when you didn''t expect it! The error occurred while evaluating nil.b On Apr 6, 10:25 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 6 Apr 2008, at 12:08, Vincent.Z wrote: > > > > > question one: > > > is there any select box tag for form_for? > > Like f.select (assuming f is your form builder?) > > > > > > > > > now,perhaps i just can use the select or select_tag? > > > question tow: > > > i have a A model,it has one B such as: > > > class A< ActiveRecord::Base > > belongs_to :B > > > when i use the form_for tag,how can i output the variable name?like > > this: > > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > > <%=f.text_area "b[name]"%> > > ........ > > <%end%> > > You''re trying to display a.b.name ? If so you could either drop down a > level and use text_area_tag, or use fields_for to create a scope > around b (and then you can just do other_f.text_area :name) > > Fred- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Does anyone have encountered the problem? On Apr 6, 11:02 pm, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> i wanna set up a blank text area for b.name,i dont wanna display > something. > > when i code : > > <%fields_for :b,@a.b do |b|%> > > there is one error as follows: > > You have a nil object when you didn''t expect it! > The error occurred while evaluating nil.b > > On Apr 6, 10:25 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > On 6 Apr 2008, at 12:08, Vincent.Z wrote: > > > > question one: > > > > is there any select box tag for form_for? > > > Like f.select (assuming f is your form builder?) > > > > now,perhaps i just can use the select or select_tag? > > > > question tow: > > > > i have a A model,it has one B such as: > > > > class A< ActiveRecord::Base > > > belongs_to :B > > > > when i use the form_for tag,how can i output the variable name?like > > > this: > > > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > > > <%=f.text_area "b[name]"%> > > > ........ > > > <%end%> > > > You''re trying to display a.b.name ? If so you could either drop down a > > level and use text_area_tag, or use fields_for to create a scope > > around b (and then you can just do other_f.text_area :name) > > > Fred- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This is not a helpful response whatsoever. People don''t come to post in Google Groups to get pointed to documentation. On Apr 6, 5:41 am, Mukund <marut...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> http://api.rubyonrails.org/ is the best resource for queries like > these. The answer to your question is a yes, just browse through the > documentation to figure it out. > > On Apr 6, 4:08 pm, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > question one: > > > is there any select box tag for form_for? > > > now,perhaps i just can use the select or select_tag? > > > question tow: > > > i have a A model,it has one B such as: > > > class A< ActiveRecord::Base > > belongs_to :B > > > when i use the form_for tag,how can i output the variable name?like > > this: > > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > > <%=f.text_area "b[name]"%> > > ........ > > <%end%> > > > it doesnt work. > > > thanks 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Your @a variable is nil. Make sure that you''re setting it. Also, I''m not sure if it would mess anything up or not, but naming the param :b and setting the block variable to |b| might get confusing. Perhaps you should use something else in the block. -Kyle On Apr 7, 7:53 am, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Does anyone have encountered the problem? > > On Apr 6, 11:02 pm, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > i wanna set up a blank text area for b.name,i dont wanna display > > something. > > > when i code : > > > <%fields_for :b,@a.b do |b|%> > > > there is one error as follows: > > > You have a nil object when you didn''t expect it! > > The error occurred while evaluating nil.b > > > On Apr 6, 10:25 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > On 6 Apr 2008, at 12:08, Vincent.Z wrote: > > > > > question one: > > > > > is there any select box tag for form_for? > > > > Like f.select (assuming f is your form builder?) > > > > > now,perhaps i just can use the select or select_tag? > > > > > question tow: > > > > > i have a A model,it has one B such as: > > > > > class A< ActiveRecord::Base > > > > belongs_to :B > > > > > when i use the form_for tag,how can i output the variable name?like > > > > this: > > > > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > > > > <%=f.text_area "b[name]"%> > > > > ........ > > > > <%end%> > > > > You''re trying to display a.b.name ? If so you could either drop down a > > > level and use text_area_tag, or use fields_for to create a scope > > > around b (and then you can just do other_f.text_area :name) > > > > Fred- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Matthew Carriere wrote:> This is not a helpful response whatsoever. People don''t come to post > in Google Groups to get pointed to documentation.Repeating all that info would degrade this forum. When a newb obviously does not know about the /Agile Web/ book, or the online APIs, or how to Google for our common FAQs, they need a meta-answer. -- Phlip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
@vincent -- I like the api at railsbrain.com It''s the same api info, just has a little ajax added to it making it easier to search. On Apr 7, 3:04 pm, Kyle <kyle.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Your @a variable is nil. Make sure that you''re setting it. > > Also, I''m not sure if it would mess anything up or not, but naming the > param :b and setting the block variable to |b| might get confusing. > Perhaps you should use something else in the block. > > -Kyle > > On Apr 7, 7:53 am, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Does anyone have encountered the problem? > > > On Apr 6, 11:02 pm, "Vincent.Z" <zhu1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > i wanna set up a blank text area for b.name,i dont wanna display > > > something. > > > > when i code : > > > > <%fields_for :b,@a.b do |b|%> > > > > there is one error as follows: > > > > You have a nil object when you didn''t expect it! > > > The error occurred while evaluating nil.b > > > > On Apr 6, 10:25 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > On 6 Apr 2008, at 12:08, Vincent.Z wrote: > > > > > > question one: > > > > > > is there any select box tag for form_for? > > > > > Like f.select (assuming f is your form builder?) > > > > > > now,perhaps i just can use the select or select_tag? > > > > > > question tow: > > > > > > i have a A model,it has one B such as: > > > > > > class A< ActiveRecord::Base > > > > > belongs_to :B > > > > > > when i use the form_for tag,how can i output the variable name?like > > > > > this: > > > > > > <%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%> > > > > > <%=f.text_area "b[name]"%> > > > > > ........ > > > > > <%end%> > > > > > You''re trying to display a.b.name ? If so you could either drop down a > > > > level and use text_area_tag, or use fields_for to create a scope > > > > around b (and then you can just do other_f.text_area :name) > > > > > Fred- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---