ruby on rails 3.2 - ActiveAdmin member_action gives 401 Unauthorized response -
i building rails app using active_admin 0.5.1.
in app/admin/plays.rb defined admin resource this:
activeadmin.register play member_action :upload, :method => :post ... end def index ... end end
note added non-standard upload-action described here: http://activeadmin.info/docs/8-custom-actions.html
now whenever phone call index action, works fine. when post fellow member action :upload though, 401 response:
started post "/admin/plays/1/upload.js" 127.0.0.1 @ 2013-02-13 18:46:36 +0100 processing admin::playscontroller#upload js parameters: {...} warning: can't verify csrf token authenticity adminuser load (0.4ms) select "admin_users".* "admin_users" "admin_users"."id" = 1 limit 1 (0.1ms) begin transaction (0.0ms) commit transaction completed 401 unauthorized in 7ms
furthermore after getting error, admin user logged out.
what missing here? expecting actions defined via member_action work standard actions.
found reason.
"warning: can't verify csrf token authenticity"
kind of give-away.
you need add together authenticity_token param ajax upload request create devise happy.
i still wish devise have given more detailed hint on happened in detail.
ruby-on-rails-3.2 activeadmin
No comments:
Post a Comment