Commit d78f3c15ca50442a952c0e9af119b520bd273ec2
1 parent
f60c8edf
Exists in
staging
and in
7 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
@@ -779,6 +779,12 @@ class Article < ActiveRecord::Base | @@ -779,6 +779,12 @@ class Article < ActiveRecord::Base | ||
779 | true | 779 | true |
780 | end | 780 | end |
781 | 781 | ||
782 | + #FIXME make this test | ||
783 | + #Define which parameters will be returned in json object | ||
784 | + def as_json(options = {}) | ||
785 | + super(:only => [:id, :name, :body, :created_at], :methods => [:title]) | ||
786 | + end | ||
787 | + | ||
782 | private | 788 | private |
783 | 789 | ||
784 | def sanitize_tag_list | 790 | def sanitize_tag_list |