> Hi,
>
> I'm rendering a json response from my controller simply as:
>
> hobo_show do
> @this = find_instance
> render :json => @this.drill_detail
> end
>
> Problem is the response posts as content-type="text/html".
>
> Rails 3 doc says it should render as "application/json".
>
The block passed to hobo_show is called in a structure that looks (roughly) like this:
def hobo_show
...find the record, etc...
if block_given?
respond_to do |format|
yield format
end
else
format.html { yield }
end
end
If you want to do what you're describing, you'll need to add the format argument to your block. I don't believe you have to *use* it, though - so you may be able to skip adding a 'format.json' block.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo Users" group.
To post to this group, send email to hobo...@googlegroups.com.
To unsubscribe from this group, send email to hobousers+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.