render partial in rails

51 views Asked by At

In my application I have an button as below.

<button type="button" data-toggle="modal" data-target="#askNetworkFormModal" class="hidden-xs btn btn-primary mb-10" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
   <span class=""><b>
     Ask
   </b></span>
</button>

Here data-target is modal call askNetworkFormModal which is in _askthenetwork.html.erb

I rendered it within application.html.erb as below

<%= render partial: 'layouts/askthenetwork' %>

I just want to render this only for the page which include my button. How can I do this.

1

There are 1 answers

0
Dinu On BEST ANSWER

I had resolve this by changing code as below.

<% if controller_name =="home" && action_name == "feed"%>
    <%= render partial: 'layouts/askthenetwork' %>
<% end %>