Class: RailsEmbedEditor::EditorController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rails_embed_editor/editor_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/rails_embed_editor/editor_controller.rb', line 3

def edit
  filename = params[:filename]
  text = params[:content]
  if filename.nil? or text.nil?
    render :json => {:success => false, :params => params.to_json}
  else
    manager = RailsEmbedEditor::FileManager.from_options(filename, params)
    manager.save_text text
    render :json => {:success => true}
  end

end