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!!!
On Sunday, June 8, 2014 1:33:24 AM UTC+1, Dinna Gonzales wrote:
Inside my home.html.erb. I am rendering a partial inside a modal for my sign-up.
What I actually want to accomplish is rerendering the partial inside the modal
once User.save does not work. Please help!!!
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 (
Working with JavaScript in Rails — Ruby on Rails Guides).
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