Topic: pass params to new [SOLVED]

i have a simple controller and i am passing in a account id  but when i go save if ti has any errors i loose the id.

View

= simple_form_for([:users, contact], :html => {:class => 'form-horizontal' }) do |f|
  = f.input :account_id, :as => :hidden, :input_html => {:value => params[:account_id]}
  = f.button :submit, :class => 'pull-right'

controller

expose(:contacts){ Contact.where(:account_id => params[:account_id]).order("id DESC").scoped{} }
expose(:contact)
def create
    if contact.save
      flash[:notice] = t(:contact_was_successfully_created)
      redirect_to(agents_contacts_path)
    else
      # Here i am loosing the account_id
      render :new
    end
  end

Re: pass params to new [SOLVED]

on your form update like

-if params[:account_id]
    = f.input :account_id,:as => :hidden, :input_html => {:value => params[:account_id]}
  -else
    = f.input :account_id, :as => :hidden