I have two models: User and Role.
The User attributes are:
name:string
email:string
admin:boolean
role_id:integer
The Role attributes are:
designer:boolean
developer:boolean
The associations that I've set is that user belongs_to role and role has_many users.
When the user signs up, I want him to choose his position (either designer or developer). However, I get the role_id as an Integer field when I want to display the positions (designer and developer) to choose from. Can anyone help me with that?
What you want to do is called "Nested Models".
First you have to tell the model to allow the other model like this:
the next thing is in your view
Now last but bot least you to be able to accept the new params in the controller
you can look at a sample app https://github.com/mzaragoza/sample_nestes_forms
I hope that this helps Happy Hacking