forms - Rails form_for submit button not working -
thank patience. still pretty new rails.
using rails 3.2
making signup page simple app. problem submit button on form doesn't cause effect, whether information in form valid or not.
the user model , database both seem work fine. if add user manually rails console, add database. far can tell, issue seems in form generated form_for.
here page in question:
<% provide(:title, 'sign up') %> <h1>sign up</h1> <div class="row"> <div class="span6 offset3> <%= form_for(@user) |f| %> <%= render 'shared/error_messages' %> <%= f.label :name %> <%= f.text_field :name %> <%= f.label :email %> <%= f.text_field :email %> <%= f.label :password %> <%= f.password_field :password %> <%= f.label :password_confirmation, "confirmation" %> <%= f.password_field :password_confirmation %> <%= f.submit "create account", class: "btn btn-large btn-primary" %> <% end %> </div> </div>
and here users controller:
def show @user = user.find(params[:id]) end def new @user = user.new end def create @user = user.new(params[:user]) if @user.save flash[:success] = "thank signing up! please check email confirm account." redirect_to @user else render 'new' end end end
submit doesn't cause type of error - doesn't cause happen @ all. no valuable information in logs.
thank in advance insight.
edit: adding code /shared/_error_messages.html.erb partial
<% if @user.errors.any? %> <div id="error_explanation"> <div class="alert alert-error"> form contains <%= pluralize(@user.errors.count, "error") %>. </div> <ul> <% @user.errors.full_messages.each |msg| %> <li>* <%= msg %></li> <% end %> </ul> </div> <% end %>
well there's nice little lesson in careful coding:
<div class="row"> <div class="span6 offset3> <%= form_for(@user) |f| %>
should have been:
<div class="row"> <div class="span6 offset3**"**> <%= form_for(@user) |f| %>
quite difference closing tag can make.
Comments
Post a Comment