Class: RedactorRails::BaseController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controller/redactor_rails/base_controller.rb

Direct Known Subclasses

DocumentsController, PicturesController

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controller/redactor_rails/base_controller.rb', line 8

def create
  @redactor = controller_model.new

  file = params[:file]
  @redactor.data = RedactorRails::Http.normalize_param(file, request)

  if @redactor.save
    render text: { filelink: @redactor.url }.to_json
  else
    render nothing: true
  end
end

#indexObject



3
4
5
6
# File 'app/controller/redactor_rails/base_controller.rb', line 3

def index
  @redactors = controller_model.order :id 
  render json: @redactors.to_json
end