Can't convert Hash into String

Hello,

I have a DB table

CREATE TABLE dbo.bookdetails
(
id numeric(38,0) NOT NULL,
name varchar(2048) NOT NULL,
system varchar(2048) NOT NULL,
desk varchar(2048) NOT NULL,
strategy varchar(2048) NOT NULL,
trader varchar(2048) NULL
)

I scaffolded it and edited my controller as:

def list
#@bookdetail_pages, @bookdetails = paginate :bookdetails, :per_page
=> 10
@books = Bookdetail.find:all
render :xml => @books.to_xml
end

However, when I try to access this page, I get “can’t convert Hash into
String” as an error.

There is another table in the same db that i scaffold and use in exactly
the same manner and it works perfectly.

Could someone please point me what I could be doing wrong.

Many Thanks,
Aman

This is just a newbie’s attempt to answer, but are any of your
fieldnames like “name” or “system” keywords in Ruby or Rails?

I tried but couldn’t find a list of keywords anywhere either for Ruby or
for Rails.

Shauna

I think that’s because system isn’t a Rails reserved word but a Ruby on.
It’s Kernel#system. Sometimes it’s easy to forget that Rails isn’t the
only
factor in RoR. Heh.

RSL

Thanks I found the problem.

I could not find “system” listed as a keyword but once I renamed this
column, things started working.

I just wish RoR could give better warning and error msgs so I could like
it even more than I already do.

Regards,
Aman

Is there a list somewhere of all Ruby keywords and Rails keywords?
(Links, please)

Hi –

On Sat, 20 Jan 2007, Shauna wrote:

Is there a list somewhere of all Ruby keywords and Rails keywords?
(Links, please)

The Ruby keywords are in the file ‘keywords’ in the Ruby source tree.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/keywords?revision=10397
(and/or somewhere on your system). I’m not sure exactly what
constitutes a Rails keyword.

David


Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (Ruby for Rails)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

The Ruby keywords are in the file ‘keywords’ in the Ruby source tree.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/keywords?revision=10397
(and/or somewhere on your system).

Thanks, David, that was really helpful. And I’m up to Chapter 9 in your
book and loving it. I like your little asides in parentheses (like this)
that help clarify and refine your point. I like that thoroughness that
addresses all the little possible gotchas (at least all the ones that
you could think of).

Shauna