ruby-gettext error_messages_for wasn't up-to-date with latest rails
changes.
i've fixed it in my version, maybe this helps you.
you need to edit gettext's rails.rb and in module L10n remove
render_error_messages_for and replace the following two functions
(L10n.error_messages_for and ActiveRecordHelper::error_messags_for) by
<pre> def error_messages_for(params, klass)
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys
: {}
objects = params.collect {|object_name|
klass.instance_variable_get("@#{object_name}") }.compact
count = objects.inject(0) {|sum, object| sum +
object.errors.count }
unless count.zero?
html = {}
[:id, :class].each do |key|
if options.include?(key)
value = options[key]
html[key] = value unless value.blank?
else
html[key] = 'errorExplanation'
end
end
record =
ActiveRecord::Base.human_attribute_table_name_for_error((options[:object_name]
|| params.first).to_s)
message_title = @error_message_title
message_explanation = @error_message_explanation
header_message = n_(message_title, count) % {:num => count,
:record => record}
error_messages = objects.map {|object|
object.errors.full_messages.map {|msg| klass.content_tag(:li, msg) } }
klass.content_tag(:div,
klass.content_tag(options[:header_tag] || :h2,
header_message) <<
klass.content_tag(:p, n_(message_explanation, count) %
{:num => count}) <<
klass.content_tag(:ul, error_messages),
html
)
end
end
end
def error_messages_for(*params)
L10n.error_messages_for(params, self)
end
end</pre>
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Railsi18n-discussion mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/railsi18n-discussion