[Rails] How do you include json attributes when using "respond_with"?
I have a controller action that returns JSON data.
def create
@comment = @site_update.comments.new
@comment.attributes = params[:comment]
@comment.author = current_user
if @comment.save
respond_with @comment, :include => :author
else
respond_with @comment.errors
end
end
This is obviously not working. How can I include the :author of the
comment with the respond_with method?
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home