Solution
--------
Because of the hashing of my password, it validated the wrong length.
Now I made sure that my validation was performed before I hashed my
password.
NEW PROBLEM (damn it's still tricky for me)
-------------------------------------------
--------------------
Stating the problem:
--------------------
Trying to validate my email with a conformation, but not working at all
(but if I do save! it sends me the :
Validation failed: Email doesn't match confirmation
What I am expecting. But unfortunately I don't get the error in my
form...
--------------------
My code:
--------------------
CustomersController
*******************
@dbCustomer.email = @customer.email
@dbCustomer.email_confirmation = @customer.email_confirmation
unless @dbCustomer.save #on save! -> Validation failed. Email doesn't
match
render :action => :edit, :notice => "Hello!"
return
end
edit.html.erb
*************
<% if @customer && @customer.is_signup == false %>
<h2>Please submit your personal password:</h2>
<%= render 'firstLoginForm'%>
<% else @customer = Customer.new %>
<h2>Please sign up to access the customer portal</h2>
<%= render 'signUpForm'%>
<% end %>
_firstLoginForm
***************
<%= form_for @customer do |f| %>
<% if @customer.errors.any? %>
<div class="form_errors">
<ul>
<% @customer.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<%end%>
</ul>
</div>
<% end %>
<%= fields_for :authentication do |a| %>
<%= a.label :password %>
<%= a.password_field :password %>
<br />
<%= a.label :password_confirmation%>
<%= a.password_field :password_confirmation %>
<% end %>
<br />
<%= f.submit "Save your changes"%>
<% end %>
_signUpForm.html.erb
********************
<%= form_for @customer do |c|%>
<% if @customer.errors.any? %>
<div id="form_errors">
<ul>
<% @customer.errors.full_messages.each do |msg| %>
<li>
<%= msg %>
</li>
<%end%>
</ul>
</div>
<% end %>
<p>
<%= c.label :id%>
<%= c.text_field :id%>
</p>
<p>
<%= c.label :name %>
<%= c.text_field :name%>
</p>
<h3>Please ad a valid e-mail to receive your credentials:</h3>
<p>
<%= c.label :email%>
<%= c.text_field :email%>
</p>
<p>
<%= c.label :email_confirmation %>
<%= c.text_field :email_confirmation %>
</p>
<p class="button">
<%= c.submit%>
</p>
<% end %>
---------------------
The exact error:
---------------------
THERE IS NO ERROR (and that is the problem)
Greetings (and a lot of thanks!)
--
Posted via http://www.ruby-forum.com/.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.