From 2cf049472fb4a9919f01ce761ff31412ba042e43 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Sun, 6 Apr 2014 19:21:50 -0300 Subject: [PATCH] adding as_json method for articles --- app/models/article.rb | 6 ++++++ 1 file changed, 6 insertions(+), 0 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index 04516a7..1ce070a 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -790,6 +790,12 @@ class Article < ActiveRecord::Base true end + #FIXME make this test + #Define which parameters will be returned in json object + def as_json(options = {}) + super(:only => [:id, :name, :body, :created_at], :methods => [:title]) + end + private def sanitize_tag_list -- libgit2 0.21.2