# Ruby On Rails Problems

**URL:** <https://www.ruby-forum.com/t/ruby-on-rails-problems/175688>\
**Category:** Rails\
**Created:** [September 17, 2009, 8:08pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688 "2009-09-17T20:08:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [September 17, 2009, 8:08pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688/1 "2009-09-17T20:08:54Z")

</div>

Ive posted the following on various forums and had no reply, and was  
told this was the place were i could get an answer:

Hi, As you may know I currently own and maintain [dev-hq.co.uk](http://dev-hq.co.uk), and  
basically ive been trying to “convert” everythig to RoR as ive been  
told this could benifit me in many ways. I asked a friend who is good  
in RoR to help me, and we managed to create an application which does  
basically everything its supposed to. However just before finishing  
the project he got bored of helping me time and time again, so there  
are some unfinished bits which I was hoping you could help with. First  
off im going to talk about an error I get when trying to edit/create  
new tutorials in a certain catagory. This is the error I get:

Category(#47881910) expected, got String(#32601110)

Ive looked everywhere for this and cant find a fix that works. Now  
because I dont want to have to post things I dont need too, Im just  
going to post the thing that I put in new and edit to get the catagory  
box to appear (on creation or edit its looking for the catagory number  
by the way):

\<%= f.label :category\_id %\> \<%= f.text\_field :category\_id %\>

So that is my first problem. Secondly since im classed even lower than  
bad in RoR I dont know how I make the tutorials in different  
catagories apear on the catagories page… If anyone knows how to do  
this please tell me.

Last of all, This is a feature which was not even started yet, next to  
the names of the tutorials on the catagory display page I want to  
display the ammount of tutorials there are in that section in  
brackets, and then have the catagories sorted on the catagory page by  
ammount of tutorials.

I know I have alot to ask, but please help guys…

PS: Sorry for the kind of unhelpful topic title, This topic is asking  
for so much I didnt know what to name it.

Thanks In Advance,

Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [September 17, 2009, 8:58pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688/2 "2009-09-17T20:58:58Z")

</div>

This is probably the part where we ask if you can archive the app and  
put it somewhere where we can download it; this is all quite vague.

The first error message means it expects an Object of class Category,  
and instead it sees an object of class String.

This also sounds like you’ve never touched Rails in your life, and your  
friend wasn’t “helping” but “coding” and probably “fixing” for you 🙂

If you are not familiar with Ruby, go through a basic Ruby tutorial.  
For a good Rails intro, go through  
[http://www.buildingwebapps.com/learningrails](http://www.buildingwebapps.com/learningrails) .

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [September 17, 2009, 9:00pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688/3 "2009-09-17T21:00:25Z")

</div>

I suggest spending a couple of days going through the Railscasts by  
Ryan B., especially those related to models, relationships and  
forms.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [September 17, 2009, 9:33pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688/4 "2009-09-17T21:33:12Z")

</div>

Is the category\_id datatype a string rather than an integer? Check  
your migrations.

-eric

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [September 18, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688/5 "2009-09-18T16:43:31Z")

</div>

Acctually it was just because I had another variable called catagory.  
Soz i took so long to reply.

Ive basically sorted all out now (by myself thank you very much), soz  
for wasted thread.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [September 18, 2009, 10:48am UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688/6 "2009-09-18T10:48:09Z")

</div>

No, the problem is that in his form\_for he didn’t pass in a Category  
object, but a string.

form\_for :category do |f|

@category should exist and be a Category model instance. The error  
pops up because the variable there apparently is just a string.

On 17 Sep 2009, at 21:31, Eric wrote:

> > basically ive been trying to “convert” everythig to RoR as ive been
> > 
> > ```
> > <%= f.text_field :category_id %>
> > 
> > ```

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [September 18, 2009, 4:44pm UTC](https://www.ruby-forum.com/t/ruby-on-rails-problems/175688/7 "2009-09-18T16:44:41Z")

</div>

Oh, and btw, those railscasts did really help!!! (although I didnt  
yet see this reply to the thread when I was chekin em out)
