Re-render partial inside a modal

Inside my home.html.erb. I am rendering a partial inside a modal for my sign-up.

<%= render partial: ‘users/form’, :controller=>“users”, :action =>“new” %>

×

**In my Users.controller.rb, I am rendering new sign up page if user inputs incorrect information! **

def create

	@user = User.new(user_params)

	if @user.save

		# session[:remember_token] = @user.id

		# @current_user = @user

		# session[:remember_token] = @user.id.to_s

		flash.now[:success] = "You have succesfully signed up!"

		redirect_to users_path

	else

       render 'new'

	end

end

What I actually want to accomplish is rerendering the partial inside the modal once User.save does not work. Please help!!! :frowning:

For a response to update only a portion of the page instead of the whole page it has to be an ajax post. Rails does have some builtin support for ajax form submission ( http://guides.rubyonrails.org/working_with_javascript_in_rails.html#form-for). You'll have to write some javascript to handle the success/failure cases yourself (in particular the redirect in the success case will no longer do what you want - you have to do the redirect client side)

Fred