Ruby on Rails
Saturday, June 7, 2014
Inside my home.html.erb. I am rendering a partial inside a modal for my sign-up.
-- <div id="myModal" class="reveal-modal" data-reveal>
<%= render partial: 'users/form', :controller=>"users", :action =>"new" %>
<a class="close-reveal-modal">×</a>
</div>
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!!!! :(
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f3647770-f351-44e5-bb21-9052a9dd49fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment