Amol.D
Amol.D

Reputation: 97

how to set bootstrap nav tab active depending on database value in rails?

I am using bootstrap styling for nav tabs in form, I want to set the active tab depending on the value fetched from database in edit screen. Can anyone help me please?

Upvotes: 0

Views: 232

Answers (1)

Monideep
Monideep

Reputation: 2810

Try this

<ul class="nav">
   <li class="<%= 'active' if @model.some_value == 'value' %>" > 
      <%= link_to 'A', "#" %> 
   </li> 
</ul>

Upvotes: 1

Related Questions