We will now create a page in the employee application, which will capture an image.
Create a folder called
Image
in the app folder.Create a file called
controller.rb
and write the following code:require 'rho/rhocontroller' class ImageController < Rho::RhoController //index action will find all the images def index @images = Image.find(:all) render :back => '/app' end //new action will take a picture from the camera and then will call camera_callback def new Camera::take_picture(url_for :action => :camera_callback) redirect :action => :index end //edit action will choose a picture from device and then call camera_callback def edit Camera::choose_picture(url_for :action => :camera_callback) "" end // delect action will remove a image def delete @image = Image.find(@params['id']) @image.destroy redirect :action => :index end def camera_callback if @params['status'] == 'ok' ...