Hi there, I ran into an error I don''t fully understand, and some cursory Googling didn''t yield any answers (at least none that I understood). I''m creating a page where users have to verify something by submitting a form. Doing so inserts a value into their user record. Here''s what I have: controller: def profile_link @current_fb = session[:fbsession].session_uid @user = User.find(params[:id]) end profile_link.rhtml: <%= start_form_tag :controller => ''users'', :action => ''update'', :id => @user %> <%= hidden_field "user", "facebook_id", @current_fb %> <%= submit_tag "Link your profile!" %> <a href="#" class="lbAction" rel="deactivate"><button>Cancel</button></a> <%= end_form_tag %> When I go to profile_link, I get this error: can''t convert Symbol into String And it points to the hidden field line. What about this line doesn''t work? The @current_fb variable? Thanks in advance! Dave -- 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 neither ''can''t convert'' nor ''can''t convert Symbol to String'' in the source of 1.2.3 rails or ruby 1.8.6. My best guess would be an empty string. Michael On May 28, 6:02 pm, "Dave A." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi there, > > I ran into an error I don''t fully understand, and some cursory Googling > didn''t yield any answers (at least none that I understood). I''m creating > a page where users have to verify something by submitting a form. Doing > so inserts a value into their user record. Here''s what I have: > > controller: > > def profile_link > @current_fb = session[:fbsession].session_uid > @user = User.find(params[:id]) > end > > profile_link.rhtml: > > <%= start_form_tag :controller => ''users'', :action => ''update'', :id => > @user %> > <%= hidden_field "user", "facebook_id", @current_fb %> > > <%= submit_tag "Link your profile!" %> <a href="#" class="lbAction" > rel="deactivate"><button>Cancel</button></a> > > <%= end_form_tag %> > > When I go to profile_link, I get this error: > > can''t convert Symbol into String > > And it points to the hidden field line. What about this line doesn''t > work? The @current_fb variable? > > Thanks in advance! > > Dave > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Thanks! I figured it out. There were like three different things wrong with what I posted. :) MichaelLatta wrote:> I found neither ''can''t convert'' nor ''can''t convert Symbol to String'' > in the source of 1.2.3 rails or ruby 1.8.6. My best guess would be an > empty string. > > Michael > > > On May 28, 6:02 pm, "Dave A." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@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-/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 have habtm relationships as follows... class Schoolclass < ActiveRecord::Base has_and_belongs_to_many :students, :join_table => :student_schoolclasses has_and_belongs_to_many :tests, :class_name => :teste, :join_table => :test_schoolclasses end when I access Schoolclass.find(1).students, its giving all the students of class, but when I access Schoolclass.find(1).tests, its throwing an error "can''t convert Symbol into String". Please help me. -- Posted via http://www.ruby-forum.com/.
From the code you''ve pasted, :class_name => :teste seems to be the problemFrom what I know it should be :class => :teste assuming you have all the spellings correct. Thanks & Regards, Dhruva Sagar. Mike Ditka <http://www.brainyquote.com/quotes/authors/m/mike_ditka.html> - "If God had wanted man to play soccer, he wouldn''t have given us arms." On Tue, Aug 25, 2009 at 3:26 PM, Archana Thota < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have habtm relationships as follows... > > class Schoolclass < ActiveRecord::Base > has_and_belongs_to_many :students, :join_table => > :student_schoolclasses > has_and_belongs_to_many :tests, :class_name => :teste, :join_table => > :test_schoolclasses > > end > > when I access Schoolclass.find(1).students, its giving all the students > of class, but when I access Schoolclass.find(1).tests, its throwing an > error "can''t convert Symbol into String". > > Please help me. > -- > 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 -~----------~----~----~----~------~----~------~--~---
2009/8/25 Archana Thota <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > I have habtm relationships as follows... > > class Schoolclass < ActiveRecord::Base > has_and_belongs_to_many :students, :join_table => > :student_schoolclasses > has_and_belongs_to_many :tests, :class_name => :teste, :join_table =>Should that be :class_name => :test rather than :teste? Colin> :test_schoolclasses > > end > > when I access Schoolclass.find(1).students, its giving all the students > of class, but when I access Schoolclass.find(1).tests, its throwing an > error "can''t convert Symbol into String". > > Please help me. > -- > Posted via http://www.ruby-forum.com/. > > > >
2009/8/25 Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>:> 2009/8/25 Archana Thota <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> >> I have habtm relationships as follows... >> >> class Schoolclass < ActiveRecord::Base >> has_and_belongs_to_many :students, :join_table => >> :student_schoolclasses >> has_and_belongs_to_many :tests, :class_name => :teste, :join_table => > > Should that be :class_name => :test rather than :teste?Or even :class => :test> > Colin > >> :test_schoolclasses >> >> end >> >> when I access Schoolclass.find(1).students, its giving all the students >> of class, but when I access Schoolclass.find(1).tests, its throwing an >> error "can''t convert Symbol into String". >> >> Please help me. >> -- >> Posted via http://www.ruby-forum.com/. >> >> >> >> >
:class => :teste is giving error Unknown key(s): class, It should be :class_name => :teste only. I''m sure. My Two models are teste.rb , schoolclass.rb i) class Teste < ActiveRecord::Base set_table_name "tests" has_and_belongs_to_many :schoolclasses, :join_table => :test_schoolclasses, :order=>''schoolclasses.standard, ASCII(division) asc'' end ii) class Schoolclass < ActiveRecord::Base has_and_belongs_to_many :students, :join_table => :student_schoolclasses has_and_belongs_to_many :tests, :class_name => :teste, :join_table => :test_schoolclasses end What''s the problem here? -- Posted via http://www.ruby-forum.com/.
2009/8/25 Archana Thota <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > :class => :teste is giving error Unknown key(s): class, > It should be :class_name => :teste only. I''m sure. > > My Two models are teste.rb , schoolclass.rb > > i) class Teste < ActiveRecord::Base > set_table_name "tests" > has_and_belongs_to_many :schoolclasses, :join_table => > :test_schoolclasses, :order=>''schoolclasses.standard, ASCII(division) > asc'' > > end > > > ii) class Schoolclass < ActiveRecord::Base > > has_and_belongs_to_many :students, :join_table => > :student_schoolclasses > has_and_belongs_to_many :tests, :class_name => :teste, :join_table > => > :test_schoolclassesTry :class_name =''Teste'' Colin> > end > > What''s the problem here? > > > -- > Posted via http://www.ruby-forum.com/. > > > >
On Aug 25, 2009, at 6:20 AM, Archana Thota wrote:> > :class => :teste is giving error Unknown key(s): class, > It should be :class_name => :teste only. I''m sure. > > My Two models are teste.rb , schoolclass.rb > > i) class Teste < ActiveRecord::Base > set_table_name "tests" > has_and_belongs_to_many :schoolclasses, :join_table => > :test_schoolclasses, :order=>''schoolclasses.standard, ASCII(division) > asc'' > > end > > > ii) class Schoolclass < ActiveRecord::Base > > has_and_belongs_to_many :students, :join_table => > :student_schoolclasses > has_and_belongs_to_many :tests, :class_name > => :teste, :join_table > => > :test_schoolclasses:class_name => ''Teste''> > end > > What''s the problem here? > --When you get an error message about "Can''t convert Symbol to string" even though there is a Symbol#to_s, perhaps you need to look at using a String where you presently have a Symbol. -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org
I came had this error and found it was being caused by trying to add a symbol to a string. ruby-1.9.2-p180 > a string"+:a_symbol #=> TypeError: can''t convert Symbol into 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.
Hi> > ruby-1.9.2-p180 > a string"+:a_symbol #=> TypeError: can''t convert > Symbol into String > > You cannot concat string to symbol directly.convert symbol to string and then concat it. "string"+:sym.to_s *to_s *is used to convert to string ------------------------------------------------------------------------------------------ Regards sathia Here I share my experience in open source. http://www.sathia27.wordpress.com <http://www.sathia27.wordpress.com/>http://www.lquery.com<http://www.sathia27.wordpress.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.