jeudi 1 septembre 2016

How make rails forms submit if using rails-api gem. Undefined method `protect_against_forgery?

I have a rails application which is api only i am using gem rails-api. Now I am trying to create admin panel on it because we realised later that we do need an admin panel. But i think rails-api doesnt have good support for views.

When I try to submit forms it says undefined method protect_against_forgery? maybe because it doesnt supports <%= csrf_meta_tags %>

I tried to define manually this method in my controller but no luck.

def protect_against_forgery?
  true
end

How can i submit the forms without getting this error.

Aucun commentaire:

Enregistrer un commentaire