Class: Admin::ReddePhotosController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Admin::ReddePhotosController
- Defined in:
- app/controllers/admin/redde_photos_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/admin/redde_photos_controller.rb', line 10 def create if photo_params[:imageable_id].present? parent = photo_params[:imageable_type].constantize.find(photo_params[:imageable_id]) @photo = parent.photos.build(photo_params) else @photo = Redde::Photo.new(photo_params) end if @photo.save render(partial: 'photo', object: @photo) else render nothing: true, status: 422 end end |