This project is archived and is in readonly mode.
FormHelper problem with write-only fields
-
Santiago Pastorino
- Importance changed from to Low
I'm about to push a change related with this but definitely is not
going to solve your problem. You need a database field or a field
reader. Also your code doesn't work even before my commit. You can
check it out ...Let's review it ...
object.respond_to?(method_name + "_before_type_cast") ? object.send(method_name + "_before_type_cast") : object.send(method_name)Your object doesn't respond_to password_before_type_cast so this code
ends trying to execute object.send('password') and you don't have a
reader neither.Oliver, perhaps what you want to do is f.password_field :password, :value => ''
and instead of writing the password= method you can do attr_writer :password ;) -
Repository
- State changed from new to committed
(from [f95ba5c262bfd713f0a2fc656f8e645d3eea60f2]) Make InstanceTagMethods#value_before_type_cast raise if the model don't respond to attr_before_type_cast or attr method
[#3374 text_field() does not use overridden model accessors] [#5471 FormHelper problem with write-only fields state:committed] http://github.com/rails/rails/commit/f95ba5c262bfd713f0a2fc656f8e64...
-
Repository
(from [3ba8e3100548f10fce0c9784981a4589531476dd]) Make InstanceTagMethods#value_before_type_cast raise if the model don't respond to attr_before_type_cast or attr method
[#3374 text_field() does not use overridden model accessors] [#5471 FormHelper problem with write-only fields state:committed] http://github.com/rails/rails/commit/3ba8e3100548f10fce0c9784981a45...
-
Oliver Eilhard
I'm still puzzled why it did work up to 3.0 RC, but your help is greatly appreciated. I'm going with the
f.password_field :password, :value => ''and that's fine with me. Thanks, Santiago. -
Santiago Pastorino
Doesn't work for me on Rails 3 RC.
I'm uploading the example for you to see, i'm getting as expected according to the code :) ...undefined method `password' for #<Post id: nil, title: nil, created_at: nil, updated_at: nil> Extracted source (around line #20): 17: </div> 18: <div class="field"> 19: <%= f.label :password %><br /> 20: <%= f.password_field :password %> 21: </div> 22: <div class="actions"> 23: <%= f.submit %> -
Oliver Eilhard
Thanks again. Sorry for causing so much work. Next time, I'll do better testing... promised. :-)
