ruby on rails - error.full_messages are hidden and I can't figure out why -


i'm working through rails tutorial , seem stuck on getting error messages display on signup window when e-mail address, or password typed in incorrectly. i've included user controller, new user erb, , error message erb below. great. feel i've been staring @ forever , getting nowhere. in advance helping.

error_message erb

<% if @user.errors.any? %> <div id="error_explanation">     <div class="alert alert-danger">         form contains <%= @user.errors.count %> errors.     </div>     <ul>         <% @user.errors.full_messages.each |msg| %>         <li> <%= msg %> </li>         <% end %>     </ul> </div> <% end %> 

user controller

class userscontroller < applicationcontroller  def show @user = user.find(params[:id]) end  def new @user = user.new end  def create @user = user.new(user_params) if @user.save # handle succesful save else render "new"     end end  private  def user_params     params.require(:user).permit(:name, :email, :password,                                      :password_confirmation) end end 

new user erb

<%provide(:title, 'sign up')%>  <h1>sign up</h1> <div class="row"> <div class ="col-md-6 col-md-offset-3">     <%= 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-primary" %>       <% end %> </div> </div> 

just change line:

<% render 'shared/error_messages' %> 

to

<%= render 'shared/error_messages' %> 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -