2010-10-10 19:18:42 -07:00
|
|
|
class OutfitsController < ApplicationController
|
2010-11-10 13:59:54 -08:00
|
|
|
def create
|
|
|
|
if user_signed_in?
|
|
|
|
outfit = Outfit.new params[:outfit]
|
|
|
|
outfit.user = current_user
|
|
|
|
if outfit.save
|
|
|
|
render :json => true
|
|
|
|
else
|
|
|
|
render :json => {:errors => outfit.errors}, :status => :bad_request
|
|
|
|
end
|
|
|
|
else
|
|
|
|
render :json => {:errors => {:user => ['not logged in']}}, :status => :forbidden
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-11-05 15:45:05 -07:00
|
|
|
def new
|
|
|
|
@colors = Color.all
|
|
|
|
@species = Species.all
|
|
|
|
@top_contributors = User.top_contributors.limit(3)
|
|
|
|
end
|
2010-10-10 19:18:42 -07:00
|
|
|
end
|