stackjlei
stackjlei

Reputation: 10035

What does concat without an object in Rails/Ruby do?

I came upon the below code somewhere and can see that it will render a partial using some block. But what does the last part with the concat do?

  def method(stuff="example", &block)

    content = render(:partial => 'some_partial',
        :locals => { :content => capture(&block) }
    )
    concat(content)
  end

Upvotes: 0

Views: 60

Answers (2)

Shannon
Shannon

Reputation: 3018

The concat method is used to output text, when it is not within an output block such as <%= %>.

Upvotes: 0

Taryn East
Taryn East

Reputation: 27747

Concatenates the strings you pass it before rendering them

http://apidock.com/rails/ActionView/Helpers/TextHelper/concat

Upvotes: 3

Related Questions