Conditional options for Rails methods? -
i want add class form_for method, how that?
<% if @plan.price == 0 %> <%= form_for @account, :html => { :class => 'new_account' } |f| %> <% else %> <%= form_for @account, :html => { :class => 'new_account payment-form' } |f| %> <% end %> seems there's gotta more concise way pull off.
you this:
<%= form_for @account, html: { class: "new_account #{(@plan.price == 0) ? '' : 'payment-form'}" } |f| %>
Comments
Post a Comment