My registration form, which is the form for the Users model, takes a string value for the company. However, I just made a change, so users belong to companies. Therefore, I need to transfer the company object to the Users model.
I want to use a string value from a form to get a company object:
@user.company = Company.find_by_name(params[:company])
I believe the above works, however the form passes: company (which is a string) to the model when I call:
@user = User.new(params[:user])
Therefore, I want to know (and cannot find how) to remove the: company parameter before passing it to the User model.
ruby-on-rails
providence Mar 01 2018-11-11T00: 00Z
source share