简体   繁体   中英

Passing params from view to controller in ruby on rails

This is my view code

_navigation.html.erb

<% if User.current.allowed_to?(:view_repository, @project) -%>
    <div style="float: left; width: auto; padding-right: 1%">  
    <%= button_to_function l(:gerar_build_project), remote_function(:action => 'exec_client', :controller => 'GerarVersao')%>
    </div>
|
<% end -%>

exec_client is my function in controller side. Below the following code:

gerar_versao_controller.rb

def exec_client(branch)
hostname = 'localhost'
port = 8522
s = TCPSocket.open(hostname, port)
s.puts "MSG_RV"
s.puts branch.to_s
s.close
end

This code doesn't works. I get this error:

ArgumentError (wrong number of arguments (0 for 1)):

The Question is: How do I to pass the param Branch to my controller function?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM