I am new to ruby and rails. Can someone please point out what is the below construct. I see the respond_to constructs in methods (def). So is it a method inside a method ? I mean I am trying to understand the language construct here.
I do understand its functionality, that is send the response in a given format.
respond_to do |format|
format.html # index.html.erb
format.json { render json: @posts }
end
The language construct is a ruby block. But if you really want to understand
respond_tohere’s a blog post that provides a good overviewHow does respond_to work?