1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    def create

        @avatar = Avatar.new(params[:avatar])

        current_user.avatars << @avatar

        respond_to do |format|

            if @avatar.save

                format.json { render :json => @avatar, :status => :created }
                format.xml { render :xml => @avatar, :status => :created }

            else

                format.json { render :json => @avatar.errors, :status => :unprocessable_entity }
                format.xml { render :xml => @avatar.errors, :status => :unprocessable_entity }

            end

        end

    end