jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-10 00:08 UTC
Beginner Error: You have a nil object
So I set out to build an app that is very similar to the Depot app to build my experience. I added a lot of constant lists for the pulldowns on the admin add product page. Then this error? NoMethodError in Admin#new Showing app/views/admin/_form.rhtml where line #9 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.select Extracted source (around line #9): 6: 7: <p><label for="vehicle_newused">Newused</label><br/> 8: <%9: form.select :newused, 10: Vehicle::NEWUSED, 11: :prompt => "New or used vehicle?" 12: %></p> from vehicle.rb NEWUSED = [ ["New", "New"], ["Used", "Used"] ] --~--~---------~--~----~------------~-------~--~----~ 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 4/9/07, jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > So I set out to build an app that is very similar to the Depot app to > build my experience. I added a lot of constant lists for the > pulldowns on the admin add product page. Then this error? > > NoMethodError in Admin#new > > Showing app/views/admin/_form.rhtml where line #9 raised: > > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occurred while evaluating nil.select > > Extracted source (around line #9): > > 6: > 7: <p><label for="vehicle_newused">Newused</label><br/> > 8: <%> 9: form.select :newused, > 10: Vehicle::NEWUSED, > 11: :prompt => "New or used vehicle?" > 12: %></p> > > from vehicle.rb > > NEWUSED = [ > ["New", "New"], > ["Used", "Used"] > ] > > > > >The error is related to the ''form'' variable being nil, not your NEWUSED constant. So start looking there. Where is form defined? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-10 00:25 UTC
Re: Beginner Error: You have a nil object
I don''t, I thought it was universal: form.select and form.text_field and form.text_area. Hrm. I''m assuming that I missed one of these guys: <div class="fss-form"> On Apr 9, 8:14 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > So I set out to build an app that is very similar to the Depot app to > > build my experience. I added a lot of constant lists for the > > pulldowns on the admin add product page. Then this error? > > > NoMethodError in Admin#new > > > Showing app/views/admin/_form.rhtml where line #9 raised: > > > You have a nil object when you didn''t expect it! > > You might have expected an instance of Array. > > The error occurred while evaluating nil.select > > > Extracted source (around line #9): > > > 6: > > 7: <p><label for="vehicle_newused">Newused</label><br/> > > 8: <%> > 9: form.select :newused, > > 10: Vehicle::NEWUSED, > > 11: :prompt => "New or used vehicle?" > > 12: %></p> > > > from vehicle.rb > > > NEWUSED = [ > > ["New", "New"], > > ["Used", "Used"] > > ] > > The error is related to the ''form'' variable being nil, not your > NEWUSED constant. So start looking there. Where is form defined?--~--~---------~--~----~------------~-------~--~----~ 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 4/9/07, jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 9, 8:14 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > So I set out to build an app that is very similar to the Depot app to > > > build my experience. I added a lot of constant lists for the > > > pulldowns on the admin add product page. Then this error? > > > > > NoMethodError in Admin#new > > > > > Showing app/views/admin/_form.rhtml where line #9 raised: > > > > > You have a nil object when you didn''t expect it! > > > You might have expected an instance of Array. > > > The error occurred while evaluating nil.select > > > > > Extracted source (around line #9): > > > > > 6: > > > 7: <p><label for="vehicle_newused">Newused</label><br/> > > > 8: <%> > > 9: form.select :newused, > > > 10: Vehicle::NEWUSED, > > > 11: :prompt => "New or used vehicle?" > > > 12: %></p> > > > > > from vehicle.rb > > > > > NEWUSED = [ > > > ["New", "New"], > > > ["Used", "Used"] > > > ] > > > > The error is related to the ''form'' variable being nil, not your > > NEWUSED constant. So start looking there. Where is form defined? > > > I don''t, I thought it was universal: form.select and form.text_field > and form.text_area. Hrm. I''m assuming that I missed one of these > guys: > <div class="fss-form"> > > > > >You just added a div field, which certainly doesn''t do anything as far as Ruby is concerned. You''re probably missing something like <% form_for :something, :url => some_url, do |form| %> Take a closer look at whatever code you''re copying. It''ll show you exactly what you need to do. Pat --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-10 01:14 UTC
Re: Beginner Error: You have a nil object
Ok, you are correct. I found out the problem but that led to another problem. I''m converted a dynamic scaffold to a static and then edited the rhtml so that all of the fields wouldn''t be textboxes. In this case I want a select pulldown and have two options to choose from. I just removed the form. on each one and now I''ve got a page with the pulldowns with one option: prompt. On Apr 9, 8:38 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On Apr 9, 8:14 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > So I set out to build an app that is very similar to the Depot app to > > > > build my experience. I added a lot of constant lists for the > > > > pulldowns on the admin add product page. Then this error? > > > > > NoMethodError in Admin#new > > > > > Showing app/views/admin/_form.rhtml where line #9 raised: > > > > > You have a nil object when you didn''t expect it! > > > > You might have expected an instance of Array. > > > > The error occurred while evaluating nil.select > > > > > Extracted source (around line #9): > > > > > 6: > > > > 7: <p><label for="vehicle_newused">Newused</label><br/> > > > > 8: <%> > > > 9: form.select :newused, > > > > 10: Vehicle::NEWUSED, > > > > 11: :prompt => "New or used vehicle?" > > > > 12: %></p> > > > > > from vehicle.rb > > > > > NEWUSED = [ > > > > ["New", "New"], > > > > ["Used", "Used"] > > > > ] > > > > The error is related to the ''form'' variable being nil, not your > > > NEWUSED constant. So start looking there. Where is form defined? > > > I don''t, I thought it was universal: form.select and form.text_field > > and form.text_area. Hrm. I''m assuming that I missed one of these > > guys: > > <div class="fss-form"> > > You just added a div field, which certainly doesn''t do anything as far > as Ruby is concerned. > > You''re probably missing something like > > <% form_for :something, :url => some_url, do |form| %> > > Take a closer look at whatever code you''re copying. It''ll show you > exactly what you need to do. > > Pat--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-10 01:30 UTC
Re: Beginner Error: You have a nil object
Ok, I''m getting closer. This gives me the pull-down with NewNew in it -- I need it to be New or Used and not printed twice. <p><label for="vehicle_newused">Newused</label><br/> <% select ''vehicle_newused'',''newused'', [Vehicle::NEWUSED] %></p> On Apr 9, 9:14 pm, "jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok, you are correct. I found out the problem but that led to another > problem. I''m converted a dynamic scaffold to a static and then edited > the rhtml so that all of the fields wouldn''t be textboxes. In this > case I want a select pulldown and have two options to choose from. I > just removed the form. on each one and now I''ve got a page with the > pulldowns with one option: prompt. > > On Apr 9, 8:38 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On Apr 9, 8:14 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > So I set out to build an app that is very similar to the Depot app to > > > > > build my experience. I added a lot of constant lists for the > > > > > pulldowns on the admin add product page. Then this error? > > > > > > NoMethodError in Admin#new > > > > > > Showing app/views/admin/_form.rhtml where line #9 raised: > > > > > > You have a nil object when you didn''t expect it! > > > > > You might have expected an instance of Array. > > > > > The error occurred while evaluating nil.select > > > > > > Extracted source (around line #9): > > > > > > 6: > > > > > 7: <p><label for="vehicle_newused">Newused</label><br/> > > > > > 8: <%> > > > > 9: form.select :newused, > > > > > 10: Vehicle::NEWUSED, > > > > > 11: :prompt => "New or used vehicle?" > > > > > 12: %></p> > > > > > > from vehicle.rb > > > > > > NEWUSED = [ > > > > > ["New", "New"], > > > > > ["Used", "Used"] > > > > > ] > > > > > The error is related to the ''form'' variable being nil, not your > > > > NEWUSED constant. So start looking there. Where is form defined? > > > > I don''t, I thought it was universal: form.select and form.text_field > > > and form.text_area. Hrm. I''m assuming that I missed one of these > > > guys: > > > <div class="fss-form"> > > > You just added a div field, which certainly doesn''t do anything as far > > as Ruby is concerned. > > > You''re probably missing something like > > > <% form_for :something, :url => some_url, do |form| %> > > > Take a closer look at whatever code you''re copying. It''ll show you > > exactly what you need to do. > > > Pat--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
jamesdylangoldstein-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Apr-10 04:55 UTC
Re: Beginner Error: You have a nil object
This appears to be the answer, thanks to AgileROR: <p><label for="vehicle_newused">Newused</label><br/> <% select (:vehicle, :newused, Vehicle::NEWUSED, :prompt => "New or used?") %></p> On Apr 9, 9:30 pm, "jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok, I''m getting closer. This gives me the pull-down with NewNew in it > -- I need it to be New or Used and not printed twice. > > <p><label for="vehicle_newused">Newused</label><br/> > <%> select ''vehicle_newused'',''newused'', > [Vehicle::NEWUSED] > %></p> > > On Apr 9, 9:14 pm, "jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" > > <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Ok, you are correct. I found out the problem but that led to another > > problem. I''m converted a dynamic scaffold to a static and then edited > > the rhtml so that all of the fields wouldn''t be textboxes. In this > > case I want a select pulldown and have two options to choose from. I > > just removed the form. on each one and now I''ve got a page with the > > pulldowns with one option: prompt. > > > On Apr 9, 8:38 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On Apr 9, 8:14 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On 4/9/07, jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <jamesdylangoldst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > So I set out to build an app that is very similar to the Depot app to > > > > > > build my experience. I added a lot of constant lists for the > > > > > > pulldowns on the admin add product page. Then this error? > > > > > > > NoMethodError in Admin#new > > > > > > > Showing app/views/admin/_form.rhtml where line #9 raised: > > > > > > > You have a nil object when you didn''t expect it! > > > > > > You might have expected an instance of Array. > > > > > > The error occurred while evaluating nil.select > > > > > > > Extracted source (around line #9): > > > > > > > 6: > > > > > > 7: <p><label for="vehicle_newused">Newused</label><br/> > > > > > > 8: <%> > > > > > 9: form.select :newused, > > > > > > 10: Vehicle::NEWUSED, > > > > > > 11: :prompt => "New or used vehicle?" > > > > > > 12: %></p> > > > > > > > from vehicle.rb > > > > > > > NEWUSED = [ > > > > > > ["New", "New"], > > > > > > ["Used", "Used"] > > > > > > ] > > > > > > The error is related to the ''form'' variable being nil, not your > > > > > NEWUSED constant. So start looking there. Where is form defined? > > > > > I don''t, I thought it was universal: form.select and form.text_field > > > > and form.text_area. Hrm. I''m assuming that I missed one of these > > > > guys: > > > > <div class="fss-form"> > > > > You just added a div field, which certainly doesn''t do anything as far > > > as Ruby is concerned. > > > > You''re probably missing something like > > > > <% form_for :something, :url => some_url, do |form| %> > > > > Take a closer look at whatever code you''re copying. It''ll show you > > > exactly what you need to do. > > > > Pat--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---