I an new in ruby and rails.
Following the guide in ror document,I create the blog application.
Howver when I see the code generated,I found that I can not understand them,for exmpale:
def show
@post = Post.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @post }
end
end
The repond_to is a method(isn't it?),and the following block is the argument?
However what does the code inner the block mean?
format.html # show.html.erb
format.json { render json: @post }
Is the format.html is the name of the method or something else?
ANd how about the { render json: @post }>?