Validation error messages ignore viewhints
Reported by Tom Locke | April 22nd, 2009 @ 01:05 PM | in Hobo 1.0 - Final
Customisations to field names in view_hints should be used.
Comments and changes to this ticket
-
Bryan Larsen April 22nd, 2009 @ 05:02 PM
- State changed from new to open
-
Marcelo Giorgi June 23rd, 2009 @ 05:51 PM
I've made a possible for for this on my branch 404_Validation_error_messages_ignore_viewhints (of my fork: git://github.com/mgiorgi/hobo.git). Also, I attached a patch with the fix.
To accomplish that, I've extended Hobo:Model overwritting human_attribute_name method of ActiveRecord. Basically, If the field has been defined within the correspondent ViewHint file, then that value is used. Otherwise, we used the ActiveRecord's version of that method. After that, I changed rapid_forms.dryml accordingly.
The benefit of extending human_attribute_name instead of just changing rapid_forms.drmly, is that we get the correct output if we decided to call: this.errors.full_messages
-
Tom Locke June 24th, 2009 @ 05:10 PM
A couple of comments on this patch.
The file for Hobo::ViewHintsValidationsInterceptor is in the wrong place according to the module/directory conventions that we stick to. It should be in lib/hobo. Then you won't need the require statement.
Having said that I think this is too small for a module all to itself. How about a general module for viewhint related model extensions? Maybe Hobo::Model::ViewHintExtensions? We could move Hobo::Model#view_hints in there too.
There are some helpers in Hobo::HoboHelper, e.g.
this_field_name
. Maybe this can be simplified now to usehuman_attribute_name
. -
Marcelo Giorgi June 25th, 2009 @ 03:38 AM
I've pushed (to my fork git://github.com/mgiorgi/hobo.git on branch: 404_Validation_error_messages_ignore_viewhints) a new version of the patch with the suggestions you mentioned. Also I attach the patch here.
Let me know what do you think.
-
Bryan Larsen October 29th, 2009 @ 11:06 PM
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป