Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RegistrationsController example using nested_attributes
class RegistrationsController < Devise::RegistrationsController
def create
@user = User.new(sign_up_params)
if @user.save
# ...
else
render json: @user.errors, status: :unprocessable_entity
end
end
private
def sign_up_params
params.require(:user).permit(:name, :email, :phone, :password, :password_confirmation,
user_request_attributes: user_request_params)
end
def user_request_params
[:min_price, :max_price, :rating, :discount, provider_ids: [], :warranty, :keywords]
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.