# Ruby button action

**URL:** <https://www.ruby-forum.com/t/ruby-button-action/239436>\
**Category:** Ruby-Forum\
**Created:** [February 26, 2014, 9:05am UTC](https://www.ruby-forum.com/t/ruby-button-action/239436 "2014-02-26T09:05:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [February 26, 2014, 9:05am UTC](https://www.ruby-forum.com/t/ruby-button-action/239436/1 "2014-02-26T09:05:24Z")

</div>

I have a method in a controller file that I want activated only when a  
button is pressed. That what i do

#index.html.erb#

\<%= button\_to ‘Export POINT’, :controller =\> ‘my\_controller’, :action =\>  
‘create\_file\_txt’ %\>

#my\_controller.erb#

def create\_file\_txt  
.  
.  
end

#init.rb#

permission :view\_button\_exp, {:controller =\> :my\_controller, :action =\>  
:create\_file\_txt}, :require =\> :member

It’s not working, have i an erreur ??

Thanks
