Module: Sinatra::RMceUploadr::ImagesController
- Defined in:
- lib/rmce_uploadr/app/images_controller.rb
Defined Under Namespace
Modules: Helpers
Class Method Summary collapse
-
.registered(app) ⇒ Object
entry point for “register Sinatra::RMceUploadr::ImagesController”.
Class Method Details
.registered(app) ⇒ Object
entry point for “register Sinatra::RMceUploadr::ImagesController”
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rmce_uploadr/app/images_controller.rb', line 10 def self.registered(app) app.helpers Sinatra::RMceUploadr::ImagesController::Helpers app.get '/rmce_uploadr' do "hello from mce uploadr root path" end app.get '/rmce_uploadr/images' do @images = ::RMceUploadr::Image.all erb :index end # actual image upload app.post '/rmce_uploadr/images' do data = Fash.new(params[:image][:data]) @image = ::RMceUploadr::Image.new(:data => data, :tempfile => data.to_tempfile) @image.save redirect '/rmce_uploadr/images' end end |