Hey all, I get an undefined method `join'' for #<String NoMethodError. student.rb has_one :student_fail attr_accessor :student_fail_attribute #controller def student_fail @student = @student.find params[:id] def update_student_fail @student.build_student_fail params[:student][:student_fail_attribute] if @student.save #view form_for @student do |f| f.collection_select(:student_fail_attribute, StudentFailState.all, :id, :key) end I don''t understand why the error. This is the example that rails documentation gives, which looks very close to mine: collection_select(:post, :author_id, Author.all, :id, :name_with_initial, {:prompt => true}) -- View this message in context: http://old.nabble.com/undefined-method-join-tp27535930p27535930.html Sent from the RubyOnRails Users mailing list archive at Nabble.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 Feb 10, 6:40 pm, JohnMerlino <stoici...-YDxpq3io04c@public.gmane.org> wrote:> Hey all, > > I get an undefined method `join'' for #<String NoMethodError. >One what line does this error occur? Also if you''re going to post code, you might as well make it a complete piece of code - what you''ve posted there isn''t syntactically correct ruby. Fred> student.rb > has_one :student_fail > attr_accessor :student_fail_attribute > > #controller > def student_fail > @student = @student.find params[:id] > > def update_student_fail > -oe7qfRrRQfeej5ctfdv7WQ@public.gmane.org_student_fail params[:student][:student_fail_attribute] > if @student.save > > #view > form_for @student do |f| f.collection_select(:student_fail_attribute, > StudentFailState.all, :id, :key) end > > I don''t understand why the error. This is the example that rails > documentation gives, which looks very close to mine: > collection_select(:post, :author_id, Author.all, :id, :name_with_initial, > {:prompt => true}) > > -- > View this message in context:http://old.nabble.com/undefined-method-join-tp27535930p27535930.html > Sent from the RubyOnRails Users mailing list archive at Nabble.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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Quoting Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > On Feb 10, 6:40 pm, JohnMerlino <stoici...-YDxpq3io04c@public.gmane.org> wrote: > > Hey all, > > > > I get an undefined method `join'' for #<String NoMethodError. > > >join isn''t defined for strings. Arrays of strings, yes, a single string, no. Jeffrey -- 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 Thu, Feb 11, 2010 at 7:37 AM, Jeffrey L. Taylor <ror-f/t7CGFWhwGcvWdFBKKxig@public.gmane.org> wrote:> Quoting Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> >> >> On Feb 10, 6:40 pm, JohnMerlino <stoici...-YDxpq3io04c@public.gmane.org> wrote: >> > Hey all, >> > >> > I get an undefined method `join'' for #<String NoMethodError. >> > >> > > join isn''t defined for strings. Arrays of strings, yes, a single string, no. >And it doesn''t even makes sense, since join takes an array and returns each element into a String. What would one expect from "Hello, World".join ? -- Curtis Cooley curtis.cooley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org home:http://curtiscooley.com blog:http://ponderingobjectorienteddesign.blogspot.com ==============Leadership is a potent combination of strategy and character. But if you must be without one, be without the strategy. -- H. Norman Schwarzkopf -- 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.
So why does the example in rails guide work and not mine, where I tried to copy as close to it as possible? All I''m trying to do is update another table from a form. Thanks. Curtis Cooley-3 wrote:> > On Thu, Feb 11, 2010 at 7:37 AM, Jeffrey L. Taylor <ror-f/t7CGFWhwGcvWdFBKKxig@public.gmane.org> > wrote: >> Quoting Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >>> >>> >>> On Feb 10, 6:40 pm, JohnMerlino <stoici...-YDxpq3io04c@public.gmane.org> wrote: >>> > Hey all, >>> > >>> > I get an undefined method `join'' for #<String NoMethodError. >>> > >>> >> >> join isn''t defined for strings. Arrays of strings, yes, a single string, >> no. >> > And it doesn''t even makes sense, since join takes an array and returns > each element into a String. What would one expect from "Hello, > World".join ? > > -- > Curtis Cooley > curtis.cooley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > home:http://curtiscooley.com > blog:http://ponderingobjectorienteddesign.blogspot.com > ==============> Leadership is a potent combination of strategy and character. But if > you must be without one, be without the strategy. > -- H. Norman Schwarzkopf > > -- > 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. > > >-- View this message in context: http://old.nabble.com/undefined-method-join-tp27535930p27551507.html Sent from the RubyOnRails Users mailing list archive at Nabble.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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
So why does the example in rails guide work and not mine, where I tried to copy as close to it as possible? All I''m trying to do is update another table from a form. Thanks. Curtis Cooley-3 wrote:> > On Thu, Feb 11, 2010 at 7:37 AM, Jeffrey L. Taylor <ror-f/t7CGFWhwGcvWdFBKKxig@public.gmane.org> > wrote: >> Quoting Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >>> >>> >>> On Feb 10, 6:40 pm, JohnMerlino <stoici...-YDxpq3io04c@public.gmane.org> wrote: >>> > Hey all, >>> > >>> > I get an undefined method `join'' for #<String NoMethodError. >>> > >>> >> >> join isn''t defined for strings. Arrays of strings, yes, a single string, >> no. >> > And it doesn''t even makes sense, since join takes an array and returns > each element into a String. What would one expect from "Hello, > World".join ? > > -- > Curtis Cooley > curtis.cooley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > home:http://curtiscooley.com > blog:http://ponderingobjectorienteddesign.blogspot.com > ==============> Leadership is a potent combination of strategy and character. But if > you must be without one, be without the strategy. > -- H. Norman Schwarzkopf > > -- > 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. > > >-- View this message in context: http://old.nabble.com/undefined-method-join-tp27535930p27551654.html Sent from the RubyOnRails Users mailing list archive at Nabble.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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Feb 11, 2010 at 12:58 PM, JohnMerlino <stoicism1-YDxpq3io04c@public.gmane.org> wrote:> > So why does the example in rails guide work and not mine, where I tried to > copy as close to it as possible? All I''m trying to do is update another > table from a form. Thanks.If you show us the walkback, and not just the exception message, maybe somebody will have a better chance to help. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I don''t see where join is being called in the code you posted, but one thing that trips me up every once in a while is forgetting :all Student.find_by_last_name("Jones") returns a String where Student.find_all_by_last_name("Jones") or Student.find(:all, :conditions => "last_name = ''Jones''") returns an Array join will work on the latter but not the former. On Thu, Feb 11, 2010 at 10:26 AM, Rick DeNatale <rick.denatale-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Feb 11, 2010 at 12:58 PM, JohnMerlino <stoicism1-YDxpq3io04c@public.gmane.org> wrote: >> >> So why does the example in rails guide work and not mine, where I tried to >> copy as close to it as possible? All I''m trying to do is update another >> table from a form. Thanks. > > If you show us the walkback, and not just the exception message, maybe > somebody will have a better chance to help. > > > -- > Rick DeNatale > > Blog: http://talklikeaduck.denhaven2.com/ > Twitter: http://twitter.com/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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Curtis Cooley curtis.cooley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org home:http://curtiscooley.com blog:http://ponderingobjectorienteddesign.blogspot.com ==============Leadership is a potent combination of strategy and character. But if you must be without one, be without the strategy. -- H. Norman Schwarzkopf -- 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.