At first glance it would seem this question has been answered before, but not on my case (most are related to mass assignment issues and/or mongoid.) I have not been able to fin
I was able to solve this in my application, but I am using strong parameters. However the solution should still be applicable in your case.
Instead of overriding all of the methods in the RegistrationsController
I just overrode build_resource
to pass in the correct parameters needed.
def build_resource(params)
super(resource_params)
end
def resource_params
params.require(:user).permit(:email, :password, tickets_attributes: [ :description ] )
end
I also have the inverse_of
on my User
and Ticket
models, Like this:
user.rb
has_many :tickets, inverse_of: :user
ticket.rb
belongs_to :user, inverse_of :tickets
Forgot to add user_id to address migration. Rails expected it when adding belongs_to :user to the address model.