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

Popular posts from this blog

Java sticky instances of class com.mysql.jdbc.Field aggregating -