Try to move the code to your helper may help:
#YourHelper.rb
def form_for_admin(condition, &block)
if condition
form_for [:admin, @post], :html => {class: "form"}, &block
else
form_for @post, html: { class: 'form' }, &block
end
end
and use:
<%= form_for_admin current_user.admin? do |f| %>