Class: RioFileController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/rio/rio_file_controller.rb

Instance Method Summary collapse

Instance Method Details

#writeObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/rio/rio_file_controller.rb', line 5

def write
  app_path = File.join(Rio::ROOT, "public", params[:path])
  rio_path = File.join(RAILS_ROOT, "public", params[:path])

  File.open(File.exists?(app_path) ? app_path : rio_path, "w") do |f|
    f.write(params[:content])
  end
  
  render :text => "SUCCESS"
end