# Restful\_authentication and relation specification

**URL:** <https://www.ruby-forum.com/t/restful-authentication-and-relation-specification/163356>\
**Category:** Rails\
**Created:** [March 19, 2009, 3:05pm UTC](https://www.ruby-forum.com/t/restful-authentication-and-relation-specification/163356 "2009-03-19T15:05:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![indu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/eada6e/32.png) [@indu](https://www.ruby-forum.com/u/indu)\
**Post date:** [March 19, 2009, 3:05pm UTC](https://www.ruby-forum.com/t/restful-authentication-and-relation-specification/163356/1 "2009-03-19T15:05:54Z")

</div>

Hello everyone  
Trying to use restful\_authentication in my project.  
country\_id,state\_id,city\_id is the attributes of the user model. I  
specified the relation  
has\_many :users in in three of the model files and in the user model  
file specified as belongs\_to :country\_id,belongs\_to :state\_id,belongs\_to  
:city\_id. After that when i tried to save user model error “undefined  
method `to\_sym’ for #State:0x667b258” . when I remove the relation I  
can save the user model . Where I am going wrong? is it possible to  
specify relation ? Pls help.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![indu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/eada6e/32.png) [@indu](https://www.ruby-forum.com/u/indu)\
**Post date:** [March 19, 2009, 3:28pm UTC](https://www.ruby-forum.com/t/restful-authentication-and-relation-specification/163356/2 "2009-03-19T15:28:47Z")

</div>

the user shouldn’t belong to a state, the user should have\_one :state

and also your belongs to should be :state not :state\_id

---

<div class="post-metadata">

**Author:** ![indu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/eada6e/32.png) [@indu](https://www.ruby-forum.com/u/indu)\
**Post date:** [March 19, 2009, 3:52pm UTC](https://www.ruby-forum.com/t/restful-authentication-and-relation-specification/163356/3 "2009-03-19T15:52:52Z")

</div>

David Herman wrote:

> the user shouldn’t belong to a state, the user should have\_one :state
> 
> and also your belongs to should be :state not :state\_id

Corrected the relation but the problem is existing
