Sha256: 617a96e34a28558e232dfc84cc8147d9eaf0e430762daf27d2db1e422e6bcf11
Contents?: true
Size: 790 Bytes
Versions: 2
Compression:
Stored size: 790 Bytes
Contents
class RespondWithUsersController < ApplicationController respond_to :json, :xml self.responder = ActsAsApi::Responder def index @users = @user_model.all respond_with @users, :api_template => params[:api_template].to_sym, :root => :users end def show @user = @user_model.find(params[:id]) # :root => :user is only used here because we need it for the node name of the MongoUser model respond_with @user, :api_template => params[:api_template].to_sym, :root => :user end def show_default @user = @user_model.find(params[:id]) respond_with @user end def create @user = @user_model.new(params[:user]) if @user.save respond_with @user, :api_template => params[:api_template] else respond_with @user end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
acts_as_api-0.3.8 | spec/rails_app/app/controllers/respond_with_users_controller.rb |
acts_as_api-0.3.7 | spec/rails_app/app/controllers/respond_with_users_controller.rb |