How to send simple json response in Rails?

Not sure about dealing with custom MIME, but as for rendering JSON, this should work:

def testme
  respond_to do |format|
    msg = { :status => "ok", :message => "Success!", :html => "<b>...</b>" }
    format.json  { render :json => msg } # don't do msg.to_json
  end
end

Also it might help if you state which version of Ruby and Rails you are using.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)