Displaying 1 result from an estimated 1 matches for "xanot".
Did you mean:
banot
2009 Dec 26
3
Does :class_name for belongs_to have to be a string and why?
Seemingly, when I use a symbol, I get an ActiveRecord error stating
''Can''t convert symbol into String.'' Why can''t I use a symbol here?
Possibly this is a deeper misunderstanding of symbols in general on my
part.
#ActiveRecord error
class Book < ActiveRecord::Base
belongs_to :author, :class_name => :Person, :foreign_key
=> :author_id
end
#works