Commit 2cf049472fb4a9919f01ce761ff31412ba042e43
Committed by
Rodrigo Souto
1 parent
f9f5164a
Exists in
master
and in
29 other branches
adding as_json method for articles
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
app/models/article.rb
@@ -790,6 +790,12 @@ class Article < ActiveRecord::Base | @@ -790,6 +790,12 @@ class Article < ActiveRecord::Base | ||
790 | true | 790 | true |
791 | end | 791 | end |
792 | 792 | ||
793 | + #FIXME make this test | ||
794 | + #Define which parameters will be returned in json object | ||
795 | + def as_json(options = {}) | ||
796 | + super(:only => [:id, :name, :body, :created_at], :methods => [:title]) | ||
797 | + end | ||
798 | + | ||
793 | private | 799 | private |
794 | 800 | ||
795 | def sanitize_tag_list | 801 | def sanitize_tag_list |