# Has\_many / belongs\_to issues

**URL:** <https://www.ruby-forum.com/t/has-many-belongs-to-issues/167456>\
**Category:** Rails\
**Created:** [May 7, 2009, 10:47pm UTC](https://www.ruby-forum.com/t/has-many-belongs-to-issues/167456 "2009-05-07T22:47:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![p-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a3d4f5/32.png) [@p-b](https://www.ruby-forum.com/u/p-b)\
**Post date:** [May 7, 2009, 10:47pm UTC](https://www.ruby-forum.com/t/has-many-belongs-to-issues/167456/1 "2009-05-07T22:47:13Z")

</div>

Hi,

I just faced this problem today. I have a site which will have a USER  
model and a SUBMISSION model. Apart from the cosmetics parts, each user  
will be able to have multiple submissions, while each submission could  
have or not a username.

Basically, registration to make a submission will be optional. My  
question is will this work if someone tries to submit and it is not  
registered?

---

<div class="post-metadata">

**Author:** ![p-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a3d4f5/32.png) [@p-b](https://www.ruby-forum.com/u/p-b)\
**Post date:** [May 7, 2009, 10:51pm UTC](https://www.ruby-forum.com/t/has-many-belongs-to-issues/167456/2 "2009-05-07T22:51:29Z")

</div>

Bogdan -

On 7-May-09, at 4:47 PM, Bogdan P. wrote:

> question is will this work if someone tries to submit and it is not  
> registered?

validation is under your control - just don’t enforce  
(validates\_presence\_of) for :user relation

J

---

<div class="post-metadata">

**Author:** ![p-b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a3d4f5/32.png) [@p-b](https://www.ruby-forum.com/u/p-b)\
**Post date:** [May 15, 2009, 12:16pm UTC](https://www.ruby-forum.com/t/has-many-belongs-to-issues/167456/3 "2009-05-15T12:16:15Z")

</div>

Jodi S. wrote:

> Bogdan -
> 
> On 7-May-09, at 4:47 PM, Bogdan P. wrote:
> 
> > question is will this work if someone tries to submit and it is not  
> > registered?
> 
> validation is under your control - just don’t enforce  
> (validates\_presence\_of) for :user relation
> 
> J

Another small bump. When I create a new object. For example a  
SUBMISSION, how can I select from a drop down list the USER it belongs  
to?
