I can''t imagine what I''m trying to do is complicated at all in Rails. Yet, I am now getting this error: undefined method `state'' for :StudentFailState:Symbol. 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, params[:StudentFailState.state], params[:id], params[:key]) end true is an attribute of the StudentFailState table. There are three records in that table. So in the dropdown it will display the text (key attribute) of each table and each table will have an id. Any suggestions? Thanks. -- 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.
This gives undefined method join error: form_for @student do |f| f.collection_select(:student_fail_attribute, StudentFailState.all, :id, :key) end -- 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.
John Merlino wrote:> I can''t imagine what I''m trying to do is complicated at all in Rails. > Yet, I am now getting this error: undefined method `state'' for > :StudentFailState:Symbol. > > 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, params[:StudentFailState.state], params[:id], > params[:key]) end > > true is an attribute of the StudentFailState table. There are three > records in that table. So in the dropdown it will display the text (key > attribute) of each table and each table will have an id. > > Any suggestions? Thanks.Yes. Put Rails aside for a few days and focus on learning Ruby. You''re making an elementary syntax error. If you can''t see it, then you don''t yet know Ruby well enough to use Rails profitably. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.