I'm working on a html slim file for a Ruby on Rails project. I want to create a button of class btn btn-primary
(I'm using bootstrap) for a controller action. Name of controller is default_responses and action is edit. So I first did:
= link_to 'Test this', :controller => 'default_responses', :action => 'edit', :id => params[:id].to_i
This would become
<a href="/default_responses/7/edit">Test this</a>
where 7 is the id parameter and is correct for my case. However, it is not a button at all, just an anchored tag. It also redirects me to the correct page.
Then I tried
= link_to 'Test this', :controller => 'default_responses', :action => 'edit', :id => params[:id].to_i, class: 'btn btn-primary'
which gave me
<a href="/default_responses/7/edit?class=btn+btn-primary">Test this</a>
This is still not what I want as it is not a button still.
Also tried = link_to 'Test this', :controller => 'default_responses', :action => 'edit', :id => params[:id].to_i, :class=> 'btn btn-primary'
It returned <a href="/default_responses/7/edit?class=btn+btn-primary">Test this</a>
which is still wrong.
Any suggestions? Thanks.
Aucun commentaire:
Enregistrer un commentaire