This shouldn't be a problem but I can't figure it out.
Using form helpers I populate a select field like so:
...
  <%= f.select(:entity_id, entities.map {|entity| [entity.name, entity.id]}) %>
...
This is to create a User and set their entity_id. After the form submission I now have a new User whose entity_id is now the value of the option from the select field.
For example if I had selected "Store A" as my entity from the select element, the entity_id for that user is now '1' after I submit the form. This is great but I also need the entity_name "Store A" associated with the user.
So instead of my new user returning the following:
#<User name: 'John Doe', entity_id: '1', entity_name: 'Store A'>
I am getting
#<User name: 'John Doe', entity_id: '1', entity_name: nil>
Which makes sense becuase I never set entity_name.
How would I set entity_name in this form based on the selection ?
 
     
     
    