Sha256: b69a7bebb9a5c78e17ae0fecc2b2c0aa094dbd6bdd263a32704151582b143608
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
require "redactor-rails" class RedactorRails::PicturesController < ApplicationController before_filter :redactor_authenticate_user! if RedactorRails.picture_model.new.respond_to?(RedactorRails.devise_user) def index @pictures = RedactorRails.picture_model.where( RedactorRails.picture_model.new.respond_to?(RedactorRails.devise_user) ? { RedactorRails.devise_user_key => redactor_current_user.id } : { }) render :json => @pictures.to_json end 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
th_simple_content_management-0.2.2 | app/controllers/redactor_rails/pictures_controller.rb |