Here is the solution:
def custom_field(form, attribute_name, form_helper, message = "")
error = form.object.errors.get(attribute_name).present?
klasses = ["clearfix"]
klasses << "error" if error
content_tag :div, :class => klasses.join(", ") do
concat(form.label(attribute_name) +
content_tag(:div, :class => :input) do
concat(form.send(form_helper, attribute_name, :class => (error
? "error" : nil)) +
content_tag(:span, :class => "help-inline") do
concat(form.object.errors.get(attribute_name).join(". "))
end)
end)
end
end
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment