when i load the page which pulls the records from a database, using ''find_all'' in the controller it works fine. However when i reload the page i get the following error: undefined method `find_all'' i have another list of records on the same page that are pulled from another table and i never get this problem. -- 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 -~----------~----~----~----~------~----~------~--~---
dont know if it might help, but find_all will be deprecated in next versions of RoR soon if i recall correctly... use find(:all) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
undefined method `find'' for Test:Module still getting the error. -- 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 -~----------~----~----~----~------~----~------~--~---
show some code. be more describing ... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thorsten L wrote:> show some code. be more describing ...i have a controller for the first page which displays the records for 2 tables in my database. CONTROLLER 1 --------------- var1 = Table1.find(:all) var2 = Table2.find(:all) VIEW 1 --------- the view for this displays all of the records, along with checkboxes. form action = "/another_controler/run" var1.each do |record| record.name <input type=checkbox name=group[] value=record.value> end var2.each do |record2| record2.name <input type=checkbox name=group2[] value=record2.value> end CONTROLLER 2 -------------- the params from view 1 are passed to controller 2 def run variable1 = params[''group''] variable2 = params[''group2''] variable2.each{ |x| variable1.each{ |y| # y is then passed to a new object newVariable = Class.new(y) #methods are invoked depending on what x is equal too # eg... if x == ''example'' newVariable.example() end } } end VIEW 2 -------- the view for run displays variable1 variable1.each |y| y.name end THE PROBLEM ------------- i have written my code in short hand just to give you an idea of the structure. the problem i have is that when the view for run (VIEW2) is invoked, when i go back to the first page i get the follwing error: undefined method ''find'' for Table1:Module -- 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 -~----------~----~----~----~------~----~------~--~---
bump please help -- 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 -~----------~----~----~----~------~----~------~--~---
Could you provide an actual copy of the code that is failing? Mark On 10/26/06, mmaki <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > bump please help > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Mark Van Holstyn mvette13-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://lotswholetime.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 -~----------~----~----~----~------~----~------~--~---
hi, thanks for you responses, i seem to have resolved the issue now. the model that was causing the problems was named Test, i renamed it and now it works. i assume Test is a keyword or something. -- 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 -~----------~----~----~----~------~----~------~--~---
i had the following error while trying to implement Collection _select in making a drop down of items in two models 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.map my code in the views is as follows: <%= collection_select("category", "category_id",@categorys, "id", "category_type") %> I need guidance on how to properly do this, thanks for the support yesterday. -- 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 17 November 2011 09:18, gbolahan a. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> i had the following error while trying to implement Collection _select > in making a drop down of items in two models > > 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.map > > my code in the views is as follows: > > <%= collection_select("category", "category_id",@categorys, "id",The error probably means that @categorys is nil, did you mean @categories possibly? Colin> "category_type") %> > I need guidance on how to properly do this, thanks for the support > yesterday.-- 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.
i have modified my code as follows: <%= collection_select(:category, :id, @categories, :id, :category_type, options ={:prompt => "-Select a Category"}, :class =>"category") %> i Hav also modified the definition in my controllers as follows: @categories = category.find(:all) 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.mapseems there something i dont get -- 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 17 Nov 2011, at 14:11, gbolahan a. wrote:> i Hav also modified the definition in my controllers as follows: > > @categories = category.find(:all)Classes should have a capital: Category.find(:all) and you could even bring this down to: Category.all Best regards Peter De Berdt -- 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 17 November 2011 13:11, gbolahan a. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> i have modified my code as follows: > > <%= collection_select(:category, :id, @categories, :id, :category_type, > options ={:prompt => "-Select a Category"}, :class =>"category") %> > > i Hav also modified the definition in my controllers as follows: > > @categories = category.find(:all)That should be Category.find(:all)> > 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.map > seems there something i dont getYou have not said where that error occurs, but wherever it is something is nil. Have a look at the Rails Guide on Debugging, that will show you how to use ruby-debug to break into code, inspect data and follow the flow. Then when you get this sort of error you can put in breakpoints and check each of the variables to find which one is nil. Colin> > -- > 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. > >-- gplus.to/clanlaw -- 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.
i have modified my code as follows: <%= collection_select(:category, :id, @categories, :id, :category_type, options ={:prompt => "-Select a Category"}, :class =>"category") %> i Hav also modified the definition in my controllers as follows: @categories = category.find(:all) but it still gives me the following error 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.mapseems there something i dont get -- 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 17 November 2011 13:56, gbolahan a. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> i have modified my code as follows: > > <%= collection_select(:category, :id, @categories, :id, :category_type, > options ={:prompt => "-Select a Category"}, :class =>"category") %> > > i Hav also modified the definition in my controllers as follows: > > @categories = category.find(:all) > > but it still gives me the following errorYou have not said, but I presume that you mean that it still gives you the error with Category.find. How did you get on with ruby-debug? Colin> > 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.map > seems there something i dont get > > -- > 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. > >-- gplus.to/clanlaw -- 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.