I have this controller:
class AccountsController < ApplicationController
def create
if @current_account.update_attributes(account_params)
redirect_to :dashboard
end
end
def account_params
params.require(:account).permit(:company, users_attributes: [:name, phone_attributes: [:number]])
end
end
as you can see, i have 2 levels of nested attributes, the issue is I used to add a virtual attribute before using strong parameters like this:
def create
@phone = @current_account.users.phone.requires_us_format = true
...
end
How to achieve this using both nested attributes and strong parameters?