I implemented creating an object within another object according to this Railscast: http://railscasts.com/episodes/74-complex-forms-part-2 but I''m getting this error after I submit. Any ideas? undefined method `each'' for "":String -- 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 didn''t look at the code but it appears you are trying to iterate over an empty string. -- 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 31 March 2010 19:21, ES <emstolfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I implemented creating an object within another object according to > this Railscast: > > http://railscasts.com/episodes/74-complex-forms-part-2 > > but I''m getting this error after I submit. Any ideas? > > undefined method `each'' for "":StringI think you may need to show us the code around the error. 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 Wed, Mar 31, 2010 at 2:21 PM, ES <emstolfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I implemented creating an object within another object according to > this Railscast: > > http://railscasts.com/episodes/74-complex-forms-part-2 > > but I''m getting this error after I submit. Any ideas? > > undefined method `each'' for "":StringI''m guessing that you are using Ruby 1.9, Ruby 1.8 had a String#each method, Ruby 1.9 does not, you need to use each_line instead. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- 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 Mar 31, 7:21 pm, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I implemented creating an object within another object according to > this Railscast: > > http://railscasts.com/episodes/74-complex-forms-part-2 > > but I''m getting this error after I submit. Any ideas? > > undefined method `each'' for "":StringSounds like you have hit the same one I did: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/89c99cd42054552b/344f411e70d378e0 -- 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.
As it turns out, I had declared that my main object class had many of another type of object (photos). In my object controller new method I had @object.photos.build But then in my form I only had one field for the photo object. It was trying to build the photo objects with just one string as input and that is what was giving the method ''each'' error for String. On Apr 1, 3:43 am, mikrogroove <o...-ghLYL0gzFSECT2ftz+WiyQ@public.gmane.org> wrote:> On Mar 31, 7:21 pm, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I implemented creating an object within another object according to > > this Railscast: > > >http://railscasts.com/episodes/74-complex-forms-part-2 > > > but I''m getting this error after I submit. Any ideas? > > > undefined method `each'' for "":String > > Sounds like you have hit the same one I did: > > http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/...-- 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.