Ruby : Unexpected error : Got surprised :: unexpected ‘+’, expecting keyword_end

Today I stumbled upon something strange in RUBY,

if @user
  content_tag(:span, class: "post-editer") do
    link_tag "#" do
      content_tag(:i, "", class: "fa fa-cog")
    end +
        get_dropdown_option
  end
else
  "".html_safe
end

ruby_error

/home/john/projects/thepact/app/helpers/pact_profile_page_helper.rb:240: syntax error, unexpected '+', expecting keyword_end

Extracted source (around line #240):
238
239
240
241
242
243
 
 link_tag "#" do
 content_tag(:i, "", class: "fa fa-cog")
 end +
 get_dropdown_option
 end
 else

Solution:

content_tag(:span, class: "post-editer") do
  link_markup = link_tag "#" do
    content_tag(:i, "", class: "fa fa-cog")
  end
  link_markup + get_dropdown_option
end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s