Class: RedactorRails::PicturesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RedactorRails::PicturesController
- Defined in:
- app/controllers/redactor_rails/pictures_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/redactor_rails/pictures_controller.rb', line 11 def create @picture = RedactorRails.picture_model.new file = params[:file] @picture.data = RedactorRails::Http.normalize_param(file, request) if @picture.respond_to?(RedactorRails.devise_user) @picture.send("#{RedactorRails.devise_user}=", redactor_current_user) @picture.assetable = redactor_current_user end if @picture.save render :text => { :filelink => @picture.url }.to_json else render :nothing => true end end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/redactor_rails/pictures_controller.rb', line 6 def index @pictures = RedactorRails.picture_model.all render :json => @pictures.to_json end |