railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.88k stars 2.25k forks source link

Custom action cannot display errors with PJAX enabled #1645

Closed RedXVII closed 5 years ago

RedXVII commented 11 years ago

I have a custom action that does stuff, and at the end, i do the following

flash[:error] = "Error because x"
redirect_to back_or_index

With javascript disabled, everything works perfectly,my error is displayed, but the request header answered by the server is actually 404, because the index action returns 404 if flash[:error] contains anything (why ? the template is still displayed as if nothing happened).

With javascript enabled, Pjax runs, but because of the 404, Pjax assumes it failed, and asks for a new GET on idex without pjax, and without any content in flash.

Why is the index action returning a 404 ? The only thing that it does with pjax enabled is eating away the flash array

mshibuya commented 5 years ago

https://github.com/sferik/rails_admin/commit/e0c90b3b5a490c30470280156da81350c422cc56 should have fixed this.