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.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 1, '11 at 12:13p
activeOct 1, '11 at 1:26p
posts2
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Gregory Ma: 2 posts

People

Translate

site design / logo © 2021 Grokbase