活动管理员渲染编辑页面

hol*_*den 6 validation ruby-on-rails renderaction ruby-on-rails-3 activeadmin

我可以很容易地重定向,但我想在验证失败时渲染编辑页面,所以我将所有验证方法都转移到表单中.我不确定如何使用active_admin呈现编辑操作.

如果我尝试render :action => 'edit'我得到一个模板缺少页面我也试过render active_admin_template('edit.html.arb'),它给了我一个页面内的页面,但没有错误.

有任何想法吗?

  member_action :state do
    space = Space.find(params[:id])
    if space.send(params[:state])
      #space.send(params[:state]+"!")
      flash[:notice] = "State Changed!"
      redirect_to :action => :index
    else
      #render :action => 'edit'
      #render active_admin_template('edit.html.arb')
      flash[:error] = "#{space.errors}"
      redirect_to :action => :edit
    end
  end
Run Code Online (Sandbox Code Playgroud)

Bri*_*ous 5

你试过这个吗?

render active_admin_template('edit.html.arb'), :layout => false
Run Code Online (Sandbox Code Playgroud)