omarArroum
omarArroum

Reputation: 255

Calling a Ruby method via a button

Quick question, what's the best way to call a ruby method via a button? At the moment, the button will only call a JS function but I need it carry out a Ruby method.

Basically, the button has to compare an Excel spreadsheet with my database and display the difference in a table on another page. How can I create that page without generating a new model? Sorry for the stupid question, but I've only been sticking to the conventions, hence I am unsure as to how I should create a new page.

Thanks in advance for any help

Upvotes: 1

Views: 11046

Answers (1)

Filipe Miguel Fonseca
Filipe Miguel Fonseca

Reputation: 6436

Take a look at the button_to method.

<%= button_to "Compare Excel", :action => "compareExcel" %>

Upvotes: 5

Related Questions