Sha256: 9e0d840075500bedc1deb16dfff5dbae9d47ef3e5d991b6476ea7e3a178c9817

Contents?: true

Size: 958 Bytes

Versions: 2

Compression:

Stored size: 958 Bytes

Contents

module Sinatra
  
  module RMceUploadr
    module ImagesController
    
      module Helpers
      end # module Helpers
    
      # entry point for "register Sinatra::RMceUploadr::ImagesController"
      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])
          puts data.inspect
          @image = ::RMceUploadr::Image.new(:data => data)
          @image.save
          redirect '/rmce_uploadr/images'
        end
      end
    
    end # module Defaults
  end # RMceUploadr
  
  register Sinatra::RMceUploadr::ImagesController
end # module Sinatra

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rmce_uploadr-0.0.2 lib/rmce_uploadr/app/images_controller.rb
rmce_uploadr-0.0.1 lib/rmce_uploadr/app/images_controller.rb