Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# the route
map.resources :documents, :member => { :ping => :get }

# the controller
def ping
  begin
    @document = Document.find(params[:id])
  rescue
    logger.error("could not find Document ID #{params[:id]}")
    flash[:notice] = "Could not find ID #{params[:id]}"
    redirect_to :action => :index
  else
    @percent = @document.progress
    @document_id = @document.id
    redirect_to :action => :index unless request.xhr?
  end
end

# the rhtml file
<%= periodically_call_remote(:url => (ping_document_path(@document), :method => :get ),
                             :frequency => 4,
                             :condition => "$('#{@document.id}indicator').innerHTML != 'Finished'",
                             :complete => "progressbar#{@document.id}") %>

<% end %>


# if I make the route:
map.resources :vms_documents, :active_scaffold => true, :member => { :import_vms => :put }, :member => { :ping => :post }
# and the rhtml file:
<%= periodically_call_remote(:url => ping_document_path(@document),
# everything works... but post is wrong... I am getting data, not sending...