Adding a div element in rails

i am having a helper function as

 def link_to_user(text, user, options = {})
options[:class] = options.has_key?(:class) ? "#{options[:class]} user-link" : ""
content_tag :span, :class => :vcard do
  link_to(text, user, options) +
  content_tag(:span, :style => "display: none;", :class => "userbox") do
    content_tag(:span, :class => "fn") do
      content_tag(:span, :class => "given-name") do user.firstname
       end +
      content_tag(:span, :class => "family-name") do #user.lastname 
       end
    end 
  end
end 

end

now i am trying to add a div element as a sibling to vcard span. i tried but i am getting errors as syntax error, unexpected '+', expecting kEND (SyntaxError)

please give suggestions

Answers


Have you tried:

@content = content_tag :span, :class => :vcard do
    link_to(text, user, options) +
    content_tag(:span, :style => "display: none;", :class => "userbox") do
      content_tag(:span, :class => "fn") do
        content_tag(:span, :class => "given-name") do user.firstname
        end +
        content_tag(:span, :class => "family-name") do #user.lastname 
        end
      end 
    end
  end
@content << content_tag(:div, "etc")

Need Your Help

Writing text to Image in Google App Engine (Java)

java image google-app-engine text

I'm writing code that runs on Google App Engine (Java). What I'm trying to do is augment an existing image by adding text. GAE does not have any text handling in its ImagesService.

In Selenium how to click on a hyper link that is embedded in table

table selenium webdriver

In selenium how to click on a hyper link that is embedded in table, here i want to click on link, this link is at a first entry in data table.