Ruby-on-Rails: Help with render: layout => false -
i trying access rails app resource api (it sends application/xml request) , not have parse xml file.
in resources controller have following:
def get_resource @my_resource = resources.new render :xml => @my_resource end
which produces xml file expected. if replace with:
render :layout => false
my api reports "template missing" error. i've tried following:
render :xml => @identity, :layout => false
but page renders anyway. what's right way go this?
when render :xml, not use layout because doesn't use template either. specifying :layout => false, tell rails template not exist.
now, if don't want parse xml file, have few alternatives. either:
render :json => @my_resource
or
render :text => "my resource name is: #{@my_resource.name}" # whatever want
it depends on how want result look, api expects receive. if don't find of helpful, give example of how want response look.
Comments
Post a Comment