I am having a problem seaching my Plan object with Plan.find() using an array object that appears to be setting itself up incorrectly. Here is what I am seeing. NoMethodError in Generate reportsController#advanced_plan_summary undefined method `each'' for #<Plan:0xb7605a24> /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/base.rb:1860:in `method_missing'' app/controllers/generate_reports_controller.rb:419:in `advanced_plan_summary'' Request Parameters: {"plans"=>"3/29"} How is Ruby setting up my arrays as a string like this instead. Has anyone seen this before? I am using Rails 1.2.3 Ruby 1.8.6 gems 0.94 --~--~---------~--~----~------------~-------~--~----~ 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 think that if what you get is x, you are calling x.each() but x is an object not an array. Will wrote:> I am having a problem seaching my Plan object with Plan.find() using > an array object that appears to be setting itself up incorrectly. > Here is what I am seeing. > > NoMethodError in Generate reportsController#advanced_plan_summary > > undefined method `each'' for #<Plan:0xb7605a24>-- 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?hl=en -~----------~----~----~----~------~----~------~--~---
I found the problem. You were correct. I kept thinking Ruby was misformating the parameter straing. Thinking I should see and array in Parameters: {"plans"=>"3/29"}. This was correct. @plans = Plan.find(params[:plans]) My problem was with this code for plan in @plans .... end I had to change it to for plan in @plans.to_a ... end and it worked. Thanks On Sep 25, 3:46 am, Florencio Cano <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi! > I think that if what you get is x, you are calling x.each() but x is an > object not an array. > > Will wrote: > > I am having a problem seaching my Plan object with Plan.find() using > > an array object that appears to be setting itself up incorrectly. > > Here is what I am seeing. > > > NoMethodError in Generate reportsController#advanced_plan_summary > > > undefined method `each'' for #<Plan:0xb7605a24> > > -- > Posted viahttp://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?hl=en -~----------~----~----~----~------~----~------~--~---