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

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -