# Register Error

**URL:** <https://www.ruby-forum.com/t/register-error/177491>\
**Category:** Rails\
**Created:** [October 19, 2009, 4:46am UTC](https://www.ruby-forum.com/t/register-error/177491 "2009-10-19T04:46:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 19, 2009, 4:46am UTC](https://www.ruby-forum.com/t/register-error/177491/1 "2009-10-19T04:46:43Z")

</div>

I just the Authlogic example working and I went to Register myself to  
create a user. When I did I got this error.

* * *

2 errors prohibited this user from being saved

There were problems with the following fields:

## Email is too short (minimum is 6 characters) Email should look like an email address.

## Views/Users/New.html/erb

# Register

\<% form\_for @user, :url =\> account\_path do |f| %\>  
\<%= f.error\_messages %\>  
\<%= render :partial =\> “form”, :object =\> f %\>  
\<%= f.submit “Register” %\>  
\<% end %\>

## Views/Users/\_form.erb

\<%= form.label :login %\>  
  
\<%= form.text\_field :login %\>  
  
  
  
\<%= form.label :password, form.object.new\_record? ? nil : “Change  
password” %\>  
  
\<%= form.password\_field :password %\>  
  
  
  
\<%= form.label :password\_confirmation %\>  
  
\<%= form.password\_field :password\_confirmation %\>

## App/Controllers/UsersController

class UsersController \< ApplicationController  
before\_filter :require\_no\_user, :only =\> [:new, :create]  
before\_filter :require\_user, :only =\> [:show, :edit, :update]

def new  
@user = User.new  
end

def create  
@user = User.new(params[:user])  
if @user.save  
flash[:notice] = “Account registered!”  
redirect\_back\_or\_default account\_url  
else  
render :action =\> :new  
end  
end

def show  
@user = @current\_user  
end

def edit  
@user = @current\_user  
end

def update  
@user = @current\_user # makes our views “cleaner” and more  
consistent  
if @user.update\_attributes(params[:user])  
flash[:notice] = “Account updated!”  
redirect\_to account\_url  
else  
render :action =\> :edit  
end  
end  
end

Are there any other pages I should look into?

Thanks,

Kevin

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 19, 2009, 4:51am UTC](https://www.ruby-forum.com/t/register-error/177491/2 "2009-10-19T04:51:24Z")

</div>

On Sun, Oct 18, 2009 at 7:45 PM, Kevin M [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Email should look like an email address.  
> \<% end %\>  
>   
>   
> def new  
> end  
> def update
> 
> Are there any other pages I should look into?
> 
> Thanks,
> 
> Kevin

Kevin, the following two validations failed for your model in question:

Email is too short (minimum is 6 characters)  
Email should look like an email address.

Thus, what e-mail are you using for input and what does the validations  
for the e-mail look like?

-Conrad

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 29, 2009, 5:10am UTC](https://www.ruby-forum.com/t/register-error/177491/3 "2009-10-29T05:10:17Z")

</div>

There is an input for login, password and password confirmation. I’m  
using my Gmail email so I’m confident it is correct and long enough.

I will check all my forms and pages are correct.

## This is the new.html.erb:

# Register

\<% form\_for @user, :url =\> account\_path do |f| %\>  
\<%= f.error\_messages %\>  
\<%= render :partial =\> “form”, :object =\> f %\>  
\<%= f.submit “Register” %\>  
\<% end %\>

## This is the \_form.erb:

\<%= form.label :login %\>  
  
\<%= form.text\_field :login %\>  
  
  
  
\<%= form.label :password, form.object.new\_record? ? nil : “Change  
password” %\>  
  
\<%= form.password\_field :password %\>  
  
  
  
\<%= form.label :password\_confirmation %\>  
  
\<%= form.password\_field :password\_confirmation %\>

I’ll check other files tomorrow.

Kevin
