Adding images to registration process

This commit is contained in:
Rob Harrington
2014-09-19 12:34:48 +10:00
parent e9dd863462
commit d3e72b5a2a
23 changed files with 283 additions and 46 deletions

View File

@@ -27,9 +27,9 @@ module Api
end
def update
authorize! :update, Enterprise
@enterprise = Enterprise.find(params[:id])
authorize! :update, @enterprise
if @enterprise.update_attributes(params[:enterprise])
render text: @enterprise.id, :status => 200
else
@@ -37,6 +37,19 @@ module Api
end
end
def update_image
@enterprise = Enterprise.find(params[:id])
authorize! :update, @enterprise
if params[:logo] && @enterprise.update_attributes( { logo: params[:logo] } )
render text: @enterprise.logo.url(:medium), :status => 200
elsif params[:promo] && @enterprise.update_attributes( { promo_image: params[:promo] } )
render text: @enterprise.promo_image.url(:medium), :status => 200
else
invalid_resource!(@enterprise)
end
end
private
def override_owner