List Info

Thread: validates_confirmation_of not working




validates_confirmation_of not working
country flaguser name
United States
2007-10-24 04:55:51

Hello to everyone,

Well, very frustrated with this one because I am following
the example
straight from the documentation and it is not working.

First when I try:

 validates_confirmation_of :password, :on =>
:password_update
(password_update is a def in my User model which works fine
without
this validation in please)

I get the following error:

TypeError in UsersController#update_password
nil is not a symbol

[Full trace at the end of this message.]

However, if I do only this:

validates_confirmation_of :password

It jumps over the validation because no matter what I put in
the
password and password_confirmation fields, changes are
always saved.

Any advice, greatly appreciated.

Thank you,

GPB

-----

Full trace for validates_confirmation_of :password, :on
=> :password_update

C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
validations.rb:296:in `send'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
validations.rb:296:in `validates_each'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
validations.rb:336:in `validates_confirmation_of'
#/app/models/user.rb:8
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:203:in `load_without_new_constant_marking'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:203:in `load_file'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:342:in `new_constants_in'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:202:in `load_file'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:94:in
`require_or_load_without_engine_additions'
#/vendor/plugins/engines/lib/engines/rails_exten
sions/
dependencies.rb:139:in `require_or_load'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:248:in `load_missing_constant'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:452:in `const_missing'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:464:in `const_missing'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:260:in `load_missing_constant'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:468:in `const_missing'
#/app/controllers/application.rb:9:in
`admin_authenticate'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
filters.rb:456:in `send'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
filters.rb:456:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
filters.rb:435:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
filters.rb:637:in `call_filter'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
filters.rb:619:in `perform_action_without_benchmark'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
benchmarking.rb:66:in `perform_action_without_rescue'
C:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
benchmarking.rb:66:in `perform_action_without_rescue'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
rescue.rb:83:in `perform_action'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
base.rb:430:in `send'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
base.rb:430:in `process_without_filters'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
filters.rb:624:in
`process_without_session_management_support'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
session_management.rb:114:in `process'
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
base.rb:330:in `process'
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb
:41:in
`dispatch'
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb:
113:in `handle_dispatch'
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb:79:in
`service'
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in
`start_thread'
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start_thread'
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb:63:in
`dispatch'
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/serv
ers/
webrick.rb:59
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
`gem_original_require'
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
`require'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:495:in `require'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:342:in `new_constants_in'
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
dependencies.rb:495:in `require'
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/serv
er.rb:39
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
`gem_original_require'
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
`require'
script/server:3


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
United Kingdom
2007-10-24 05:02:49

On 24 Oct 2007, at 10:55, GPB wrote:

>
>
> Hello to everyone,
>
> Well, very frustrated with this one because I am
following the example
> straight from the documentation and it is not working.
>
> First when I try:
>
>  validates_confirmation_of :password, :on =>
:password_update
> (password_update is a def in my User model which works
fine without
> this validation in please)

You can't do that. :on must be one of :save, :create or
:update

Fred

--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
United States
2007-10-24 05:04:27

Hello again...

I will answer my first question.

I thought the :on option could take any def from the
controller and
apply the validation only when that action was called. But
now I see
it only takes :save, :create and :update.

However, even when putting :update as the :on option, it is
still
bypassing the validation even though the data in the fields
are not
equal.

And one correction in my previous post, password_update is a
def in my
controller, not in my model, like I stated previously.

Thanks again,

On Oct 24, 11:55 am, GPB <gbar...gmail.com> wrote:
> Hello to everyone,
>
> Well, very frustrated with this one because I am
following the example
> straight from the documentation and it is not working.
>
> First when I try:
>
>  validates_confirmation_of :password, :on =>
:password_update
> (password_update is a def in my User model which works
fine without
> this validation in please)
>
> I get the following error:
>
> TypeError in UsersController#update_password
> nil is not a symbol
>
> [Full trace at the end of this message.]
>
> However, if I do only this:
>
> validates_confirmation_of :password
>
> It jumps over the validation because no matter what I
put in the
> password and password_confirmation fields, changes are
always saved.
>
> Any advice, greatly appreciated.
>
> Thank you,
>
> GPB
>
> -----
>
> Full trace for validates_confirmation_of :password,
:on
> => :password_update
>
>
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
> validations.rb:296:in `send'
>
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
> validations.rb:296:in `validates_each'
>
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
> validations.rb:336:in `validates_confirmation_of'
> #/app/models/user.rb:8
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:203:in
`load_without_new_constant_marking'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:203:in `load_file'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:342:in `new_constants_in'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:202:in `load_file'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:94:in
`require_or_load_without_engine_additions'
>
#/vendor/plugins/engines/lib/engines/rails_exten
sions/
> dependencies.rb:139:in `require_or_load'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:248:in `load_missing_constant'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:452:in `const_missing'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:464:in `const_missing'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:260:in `load_missing_constant'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:468:in `const_missing'
> #/app/controllers/application.rb:9:in
`admin_authenticate'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> filters.rb:456:in `send'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> filters.rb:456:in `call'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> filters.rb:435:in `call'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> filters.rb:637:in `call_filter'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> filters.rb:619:in `perform_action_without_benchmark'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> benchmarking.rb:66:in `perform_action_without_rescue'
> C:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> benchmarking.rb:66:in `perform_action_without_rescue'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> rescue.rb:83:in `perform_action'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> base.rb:430:in `send'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> base.rb:430:in `process_without_filters'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> filters.rb:624:in
`process_without_session_management_support'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> session_management.rb:114:in `process'
>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_
controller/
> base.rb:330:in `process'
>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb
:41:in
> `dispatch'
>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb:
> 113:in `handle_dispatch'
>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb:79:in
> `service'
> C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in
`service'
> C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in
`start_thread'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start_thread'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
> C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb:63:in
> `dispatch'
>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/serv
ers/
> webrick.rb:59
>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
> `gem_original_require'
>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
> `require'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:495:in `require'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:342:in `new_constants_in'
>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/activ
e_support/
> dependencies.rb:495:in `require'
>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/serv
er.rb:39
>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
> `gem_original_require'
>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
> `require'
> script/server:3


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
Germany
2007-10-24 05:17:05
 validates_confirmation_of :password, :on =>
:password_update
(password_update is a def in my User model which works fine
without
this validation in please)

I get the following error:

TypeError in UsersController#update_password



Well i am a bit confused why u have called password_update
and you are 
getting update_password error..
check your model once again
DHH
-- 
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 rubyonrails-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
United Kingdom
2007-10-24 05:31:27

On 24 Oct 2007, at 11:04, GPB wrote:

>
>
> Hello again...
>
> I will answer my first question.
>
> I thought the :on option could take any def from the
controller and
> apply the validation only when that action was called.
But now I see
> it only takes :save, :create and :update.
>
It's not a controller thing (how would the model know the
action that  
was causing it to be saved), it's a model thing: is the
instance  
being saved for the first time  or all the time


> However, even when putting :update as the :on option,
it is still
> bypassing the validation even though the data in the
fields are not
> equal.
>

Can't guess without seeing at least some code.

Fred
> And one correction in my previous post, password_update
is a def in my
> controller, not in my model, like I stated previously.
>
> Thanks again,
>
> On Oct 24, 11:55 am, GPB <gbar...gmail.com> wrote:
>> Hello to everyone,
>>
>> Well, very frustrated with this one because I am
following the  
>> example
>> straight from the documentation and it is not
working.
>>
>> First when I try:
>>
>>  validates_confirmation_of :password, :on =>
:password_update
>> (password_update is a def in my User model which
works fine without
>> this validation in please)
>>
>> I get the following error:
>>
>> TypeError in UsersController#update_password
>> nil is not a symbol
>>
>> [Full trace at the end of this message.]
>>
>> However, if I do only this:
>>
>> validates_confirmation_of :password
>>
>> It jumps over the validation because no matter what
I put in the
>> password and password_confirmation fields, changes
are always saved.
>>
>> Any advice, greatly appreciated.
>>
>> Thank you,
>>
>> GPB
>>
>> -----
>>
>> Full trace for validates_confirmation_of :password,
:on
>> => :password_update
>>
>>
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
>> validations.rb:296:in `send'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
>> validations.rb:296:in `validates_each'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/activ
e_record/
>> validations.rb:336:in `validates_confirmation_of'
>> #/app/models/user.rb:8
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:203:in
`load_without_new_constant_marking'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:203:in `load_file'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:342:in `new_constants_in'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:202:in `load_file'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:94:in
`require_or_load_without_engine_additions'
>>
#/vendor/plugins/engines/lib/engines/rails_exten
sions/
>> dependencies.rb:139:in `require_or_load'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:248:in `load_missing_constant'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:452:in `const_missing'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:464:in `const_missing'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:260:in `load_missing_constant'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:468:in `const_missing'
>> #/app/controllers/application.rb:9:in 

>> `admin_authenticate'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> filters.rb:456:in `send'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> filters.rb:456:in `call'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> filters.rb:435:in `call'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> filters.rb:637:in `call_filter'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> filters.rb:619:in
`perform_action_without_benchmark'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> benchmarking.rb:66:in
`perform_action_without_rescue'
>> C:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> benchmarking.rb:66:in
`perform_action_without_rescue'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> rescue.rb:83:in `perform_action'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> base.rb:430:in `send'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> base.rb:430:in `process_without_filters'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> filters.rb:624:in
`process_without_session_management_support'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> session_management.rb:114:in `process'
>>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ 
>> action_controller/
>> base.rb:330:in `process'
>>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb
:41:in
>> `dispatch'
>>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb:
>> 113:in `handle_dispatch'
>>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb: 
>> 79:in
>> `service'
>> C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in
`service'
>> C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in
`run'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in
`start_thread'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in
`start_thread'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in
`start'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in
`each'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in
`start'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in
`start'
>> C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in
`start'
>>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/webrick_serve
r.rb: 
>> 63:in
>> `dispatch'
>>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/serv
ers/
>> webrick.rb:59
>>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
>> `gem_original_require'
>>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
>> `require'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:495:in `require'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:342:in `new_constants_in'
>>
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ 
>> active_support/
>> dependencies.rb:495:in `require'
>>
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/serv
er.rb:39
>>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
>> `gem_original_require'
>>
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27
:in
>> `require'
>> script/server:3
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
United States
2007-10-24 06:14:56

Hi Fred,

I went ahead and coded the validation myself.

However, I think the problem has to do with this, used for
the
encryption of the password.

  def password=(value)
    if !value.blank?
      write_attribute("password",
Digest::SHA1.hexdigest(value))
    end
  end

Because I got it to the point that the validation worked,
but it
always returned that the values didn't match.

When I took out the lines for encryption it worked
perfectly. So it
seems it looks to compare the password string encrypted with
the
password_confirmation string not encrypted.

Care to explain how to work around this?

Thank you,






--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
United States
2007-10-24 06:16:03

Hi DHH, you are right, it was a type on my part when writing
the post,
anyway Fred already explained I can't do that for the :on
condition.

Either way, thank you.

On Oct 24, 12:17 pm, Dhh Rails <rails-mailing-l...andreas-s.net>
wrote:
>  validates_confirmation_of :password, :on =>
:password_update
> (password_update is a def in my User model which works
fine without
> this validation in please)
>
> I get the following error:
>
> TypeError in UsersController#update_password
>
> Well i am a bit confused why u have called
password_update and you are
> getting update_password error..
> check your model once again
> DHH
> --
> Posted viahttp://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 rubyonrails-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
United Kingdom
2007-10-24 06:18:00

On 24 Oct 2007, at 12:14, GPB wrote:

>
>
> Hi Fred,
>
> I went ahead and coded the validation myself.
>
> However, I think the problem has to do with this, used
for the
> encryption of the password.
>
>   def password=(value)
>     if !value.blank?
>       write_attribute("password",
Digest::SHA1.hexdigest(value))
>     end
>   end
>
> Because I got it to the point that the validation
worked, but it
> always returned that the values didn't match.
>
> When I took out the lines for encryption it worked
perfectly. So it
> seems it looks to compare the password string encrypted
with the
> password_confirmation string not encrypted.
>

I think if you do the hashing of the password in a
before_update  
you'll be ok.

Fred

--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: validates_confirmation_of not working
country flaguser name
United States
2007-10-24 06:27:15

Thank you Fred, that worked.

On Oct 24, 1:18 pm, Frederick Cheung
<frederick.che...gmail.com>
wrote:
> On 24 Oct 2007, at 12:14, GPB wrote:
>
>
>
>
>
>
>
> > Hi Fred,
>
> > I went ahead and coded the validation myself.
>
> > However, I think the problem has to do with this,
used for the
> > encryption of the password.
>
> >   def password=(value)
> >     if !value.blank?
> >       write_attribute("password",
Digest::SHA1.hexdigest(value))
> >     end
> >   end
>
> > Because I got it to the point that the validation
worked, but it
> > always returned that the values didn't match.
>
> > When I took out the lines for encryption it worked
perfectly. So it
> > seems it looks to compare the password string
encrypted with the
> > password_confirmation string not encrypted.
>
> I think if you do the hashing of the password in a
before_update  
> you'll be ok.
>
> Fred- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
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-talkgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-9]

about | contact  Other archives ( Real Estate discussion Medical topics )