Here is a Rails code:
respond_to do |format|
format.html
format.xml { render :xml => @users }
format.json { render :json => @users }
end
I know what it does. But I don't know the meaning of the commands syntax-wise.
format.xml
-- what isxml
, is this a method which an objectformat
has, correct? Where do I find its signature (or description)?{ }
-- a block or a hash? I think this is a block.render
-- a method? where do I find its signature (where in api docs)?:xml => @users
-- a hash, where:xml =>
is a key, correct?
So it could be reprented as, right?:
respond_to do |format|
format.html
format.xml do
render(:xml => @users)
end
format.json do
render(:json => @users)
end
end