Joshua Muheim
2006-Jan-11 23:39 UTC
[Rails] error_messages_for >> Cannot convert Array into String
Hi all I have the following Model: Member(id, username, first_name, last_name, hashed_password, password_salt) Now I want to allow users to register for an account using the following form: --- <%= form_tag %> <%= error_messages_for ''member'' %> <p><%= _(''Username'') %>: <%= text_field(''member'', ''username'') %></p> <p><%= _(''E-Mail'') %>: <%= text_field(''member'', ''email'', :id => ''asdf'') %></p> <p><%= _(''Password'') %>: <%= password_field(''member'', ''password'') %></p> <p><%= _(''Password confirmation'') %>: <%= password_field(''member'', ''password_confirmation'') %></p> <p><%= submit_tag(_(''Register!'')) %></p> <%= end_form_tag %> --- The register action looks like this (the password encryption with salt is not built in yet): --- def register if request.get? @member = Member.new else @member = Member.new(params[:member]) flash[:notice] = "You account was successfully created! Please login now." redirect_to :action => "login" if @member.save end end --- When I press the submit button, then I get the following error: --- TypeError in Member#register Showing app/views/member/register.rhtml where line #11 raised: cannot convert Array into String Extracted source (around line #11): 8: <fieldset> 9: <legend>Register</legend> 10: <%= form_tag %> 11: <%= error_messages_for ''member'' %> 12: <p><%= _(''Username'') %>: <%= text_field(''member'', ''username'') %></p> 13: <p><%= _(''E-Mail'') %>: <%= text_field(''member'', ''email'', :id => ''asdf'') %></p> 14: <p><%= _(''Password'') %>: <%= password_field(''member'', ''password'') %></p> --- What did I wrong? Thanks for help. Greetings, Josh -- Posted via http://www.ruby-forum.com/.