Tôi rất muốn sử dụng render :json
nhưng có vẻ như nó không linh hoạt. Whats đúng cách để làm điều này?hiển thị: json không chấp nhận các tùy chọn
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @things }
#This is great
format.json { render :text => @things.to_json(:include => :photos) }
#This doesn't include photos
format.json { render :json => @things, :include => :photos }
end
Cảm ơn, điều này đã giúp tôi. – swilliams
Giúp tôi. +1 – sscirrus