# Can't convert Hash into String

**URL:** <https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208>\
**Category:** Rails\
**Created:** [January 18, 2007, 7:53am UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208 "2007-01-18T07:53:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![athind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@athind](https://www.ruby-forum.com/u/athind)\
**Post date:** [January 18, 2007, 7:53am UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208/1 "2007-01-18T07:53:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![athind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@athind](https://www.ruby-forum.com/u/athind)\
**Post date:** [January 19, 2007, 12:32am UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208/2 "2007-01-19T00:32:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![athind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@athind](https://www.ruby-forum.com/u/athind)\
**Post date:** [January 19, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208/3 "2007-01-19T17:05:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![athind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@athind](https://www.ruby-forum.com/u/athind)\
**Post date:** [January 19, 2007, 1:34am UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208/4 "2007-01-19T01:34:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![athind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@athind](https://www.ruby-forum.com/u/athind)\
**Post date:** [January 20, 2007, 2:33am UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208/5 "2007-01-20T02:33:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![athind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@athind](https://www.ruby-forum.com/u/athind)\
**Post date:** [January 20, 2007, 3:23am UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208/6 "2007-01-20T03:23:38Z")

</div>

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](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](http://www.manning.com/black))  
(See what readers are saying! [http://www.rubypal.com/r4rrevs.pdf](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](http://www.rubypal.com))

---

<div class="post-metadata">

**Author:** ![athind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@athind](https://www.ruby-forum.com/u/athind)\
**Post date:** [January 20, 2007, 3:38am UTC](https://www.ruby-forum.com/t/cant-convert-hash-into-string/82208/7 "2007-01-20T03:38:15Z")

</div>

> 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](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
