Reputation: 5735
I have a custom method in my model called "file_url(:thumb)" to receive a specific thumbnail file URL. The method is provided by the carrierwave gem.
It is not stored in my database. How can I add this virtual attribute to @document so when I convert to json it's included?
module Api
module V1
class DocumentsController < ApiController
respond_to :json
def show
@document = Document.find(params[:id])
respond_to do |format|
format.json { render json: @document }
format.xml { render xml: @document }
end
end
end
end
end
Upvotes: 1
Views: 1021