Question

I am new to rails.I have a button and on clicking that button a daemon thread is initiated and i want the text in that button to change into "Executing" the code in view is

<td>
<% if data.vName == 'BuzzCity' or data.vName == 'neXva'%>
  <%= button_to "Start", { :action=> :execute_rake },  :remote => true  %>
<%end%>
</td>  

and in the controller is

def execute_rake
  vendor_name = 'neXva'#params[:vendorName]
  @async = ::AppMall::AsyncTask.new()
  if vendor_name == 'BuzzCity'

  elsif  vendor_name == 'neXva'

  else
   render :text => 'Unknown vendor'  
   return    
  end
 render :text => 'Executing'
end 

No correct solution

OTHER TIPS

Just add this option :disable_with

Try this,

<%= button_to "Start", { :action=> :execute_rake },  :remote => true, :disable_with => 'Executing...'  %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top