LoginSignup
1
0

More than 5 years have passed since last update.

ActiveAdmin でリダイレクト先を変更する方法

Last updated at Posted at 2016-10-19

登録・更新・削除 後のリダイレクト先を変更したい場合、
activeadmin は inherited_resources gem を利用しているので
https://github.com/josevalim/inherited_resources#overwriting-actions
に記載されている方法を使えば実現できる。

ActiveAdmin.register AdminUser do
  controller do
    def update
      super do |format|
        # 正常に保存された場合は所属法人の詳細画面へリダイレクト
        if resource.valid?
          format.html { redirect_to admin_company_path(resource.company) }
        end
      end
    end
  end
end

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0