Sha256: 79bd223a4ba5cba507c8eed0ee9643d5b7faa7666978ce079585504cc43f0012
Contents?: true
Size: 731 Bytes
Versions: 4
Compression:
Stored size: 731 Bytes
Contents
class PostsController < ApplicationController prepend_before_filter :load_resource embedded_association :comments => {:user => :account} embedded_association :user => [:account] embedded_association [:tags] embedded_association :category attr_accessor :resource def create resource.update_attributes(params[:post]) render json: resource end def update resource.update_attributes(params[:post]) render json: resource end def destroy resource.destroy render nothing: true end protected def load_resource self.resource = @post = if params['action'] == 'create' Post.new else Post.find(params[:id]) end end def resource_name 'post' end end
Version data entries
4 entries across 4 versions & 1 rubygems