From e0d4332b1a9ec651907b0a63dbfe2b8ecdd6a697 Mon Sep 17 00:00:00 2001 From: Marcelo Giorgi Date: Tue, 23 Jun 2009 13:42:58 -0300 Subject: [PATCH] #404 Extension to Hobo::Model class to check ViewHints for error validations --- .../viewhints_validations_interceptor.rb | 9 +++++++++ hobo/lib/hobo/model.rb | 2 ++ hobo/taglibs/rapid_forms.dryml | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) create mode 100644 hobo/lib/active_record/viewhints_validations_interceptor.rb diff --git a/hobo/lib/active_record/viewhints_validations_interceptor.rb b/hobo/lib/active_record/viewhints_validations_interceptor.rb new file mode 100644 index 0000000..d2260a2 --- /dev/null +++ b/hobo/lib/active_record/viewhints_validations_interceptor.rb @@ -0,0 +1,9 @@ +module Hobo + module ViewHintsValidationsInterceptor + def human_attribute_name(attribute_key_name, opt={}) + view_hints_field_names = self.view_hints.field_names + view_hints_field_names.include?(attribute_key_name.to_sym) ? + view_hints_field_names[attribute_key_name.to_sym] : super + end + end +end diff --git a/hobo/lib/hobo/model.rb b/hobo/lib/hobo/model.rb index 380f94e..7db95c3 100644 --- a/hobo/lib/hobo/model.rb +++ b/hobo/lib/hobo/model.rb @@ -134,6 +134,8 @@ module Hobo module ClassMethods + require 'active_record/viewhints_validations_interceptor' + include Hobo::ViewHintsValidationsInterceptor attr_accessor :creator_attribute attr_writer :name_attribute, :primary_content_attribute diff --git a/hobo/taglibs/rapid_forms.dryml b/hobo/taglibs/rapid_forms.dryml index 01a0544..f11289c 100644 --- a/hobo/taglibs/rapid_forms.dryml +++ b/hobo/taglibs/rapid_forms.dryml @@ -692,7 +692,7 @@ The completions are provided by the server with a GET request. The `complete-tar

To proceed please correct the following:

-- 1.5.6.3