How to Use Session Object in Ruby on Rails with React

Photo of Marcin Kornek

Marcin Kornek

Jun 3, 2016 • 1 min read

When trying to use fetch in React to GET, POST, etc., you can't use current_user in the controller because you don't have Session object available. Session returns:

#ActionDispatch::Request::Session:0x7ffc75e90a88 not yet loaded


You need to add credentials: 'include' to fetch params.

Read the explainer here:

Related topics

Photo of Marcin Kornek

More posts by this author

Marcin Kornek

After obtaining a master’s degree in Civil Engineering and working on the construction site, Marcin...