Displaying 1 result from an estimated 1 matches for "bookslist".
Did you mean:
booklist
2006 Jan 23
0
type mismatch because of misled array index
...ss User)
def book
@books = []
self.books.each { |b| @books << [b, nil] }
return @books
end
But when I call that method in my controller,
when ''user''
@books = User.find(params[:id]).book
I get this error:
ActiveRecord::AssociationTypeMismatch in View#bookslist
Book expected, got NilClass
RAILS_ROOT: /Volumes/TRAVELDRIVE/sandcastle/script/../config/..
Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:115:in
`raise_on_type_mismatch''
#{RAILS_ROOT}/vendor/ra...