Use REST API in Ruby on Rails Model -


i plan develop ruby on rails application uses instead of database application (in case vmware vcenter orchestrator). honest, orchestrator in turn uses database store , retrieve data, should masked portal application. have following code in controller:

class workflowscontroller < applicationcontroller   # /workflows   # /workflows.json   def index     @workflows = workflow.list      respond_to |format|       format.html # index.html.erb       format.json { render json: @workflows }     end  end 

and modified module models\workflow.rb implement list method:

class workflow    def initialize ( id, name, url )     @id = id     @name = name     @url = url  end   def  list ()    ret = array.new    wf = hash.new    vco = vco.new    vco.getall.each |link|      link['attributes'].each |attr|        wf[ attr['name'] ] = attr[ 'value' ]      end      ret.push( self.new( wf[ 'id' ], wf[ 'name' ], wf[ 'itemhref' ]  ) )    end    return   ret  end 

class vco in turn implemented in models\vco.rb

unfortunately, when i'm trying access page - http://ruby.on.rails:3000/workflows

i'm getting error message

undefined method `list' workflow:class

what i'm doing wrong?


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -