module Coupler
module Helpers
def error_messages_for(object)
return "" if object.nil? || object.errors.empty?
retval = "
} +
@breadcrumbs.inject([]) do |arr, obj|
strings =
case obj
when String
[obj]
when nil
[]
else
class_name = obj.class.to_s.split("::")[-1]
if obj.new?
["New #{class_name}"]
elsif
url += "/#{class_name.downcase}s/#{obj.id}"
if obj.respond_to?(:name)
["#{class_name}s", %{
#{obj.name}}]
else
[%{
#{class_name} ##{obj.id}}]
end
end
end
arr.push(*strings.collect { |x| %{
#{x}
} })
end.join(%{
/
}) +
%{