2012-03-04 161 views

回答

1

相關聯的模型和屬性-可選的,需要被傳遞到JSON在控制器:

post.to_json(:include => :user => {:only => :username }) 

參見to_json (apidock)