【发布时间】:2011-10-25 11:29:00
【问题描述】:
我可以轻松地重定向,但我想在验证失败时渲染编辑页面,因此我将所有验证方法转移到表单中。我不确定如何使用 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
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 validation activeadmin renderaction