All Case Studies Design Development Interviews Our Way Project Management

How To Use Session Object In Ruby on Rails With React

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

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

Solution

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

Read the explainer here: https://github.com/github/fetch#sending-cookies

 

 

 

 

Follow Netguru
Join our Newsletter

READ ALSO FROM React
Read also
Need a successful project?
Estimate project or contact us