What you have is fine if you are working on a 1-many relationship I
suppose.  You could write a custom validation to check and see if a valid
role has been assigned to the user

validates :role_id, presence: true

just checks if a value is there, not necessarily if it is a valid role id.
 You can leave it for now but to tighten things up in the future you may
look into it


On 5 November 2013 13:37, BitGub <notifications@github.com> wrote:

> In app/models/user.rb:
>
> >    before_save { self.email = email.downcase }
> > +
> > +  validates :role_id, presence: true
>
> Could you expand on this slightly. I'm not sure what I need to check in
> regards to this association
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/BitGub/zucono/pull/6/files#r7430110>
> .
>