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 ------------------------------------------------------------- <h1>Register</h1> <% 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 %><br /> <%= form.text_field :login %><br /> <br /> <%= form.label :password, form.object.new_record? ? nil : "Change password" %><br /> <%= form.password_field :password %><br /> <br /> <%= form.label :password_confirmation %><br /> <%= form.password_field :password_confirmation %><br /> 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
On Sun, Oct 18, 2009 at 7:45 PM, Kevin M <meyer.kevin.a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 > ------------------------------------------------------------- > <h1>Register</h1> > > <% 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 %><br /> > <%= form.text_field :login %><br /> > <br /> > <%= form.label :password, form.object.new_record? ? nil : "Change > password" %><br /> > <%= form.password_field :password %><br /> > <br /> > <%= form.label :password_confirmation %><br /> > <%= form.password_field :password_confirmation %><br /> > > > 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 >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> > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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: ------------------------------------- <h1>Register</h1> <% 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 %><br /> <%= form.text_field :login %><br /> <br /> <%= form.label :password, form.object.new_record? ? nil : "Change password" %><br /> <%= form.password_field :password %><br /> <br /> <%= form.label :password_confirmation %><br /> <%= form.password_field :password_confirmation %><br /> I''ll check other files tomorrow. Kevin On Oct 18, 10:49 pm, Conrad Taylor <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sun, Oct 18, 2009 at 7:45 PM, Kevin M <meyer.kevi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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 > > ------------------------------------------------------------- > > <h1>Register</h1> > > > <% 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 %><br /> > > <%= form.text_field :login %><br /> > > <br /> > > <%= form.label :password, form.object.new_record? ? nil : "Change > > password" %><br /> > > <%= form.password_field :password %><br /> > > <br /> > > <%= form.label :password_confirmation %><br /> > > <%= form.password_field :password_confirmation %><br /> > > > 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 > > 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 > >