How can I maintain a session across Ruby on Rails pages in an embedded app?

Hello I have successfully create a ruby on rails app based on instructions https://github.com/Shopify/shopify_app

Rails v7, shopify_app v22, Ruby 3.2

For my app I generate an MVC with db tables to save some data

rails generate scaffold post title:string body:text

Then I set the root to the root :to => ‘posts#index’ which works fine and I see the index page from the posts_controller.rb (include ShopifyApp::EmbeddedApp include ShopifyApp::EnsureInstalled added like in Home controller to maintain Shopify session)

However when I go to /posts/new or posts/1 to create new or show existing I see Shopify UI with prompt to login
It seems to me the Shopify gem session is not maintained across the rails pages

What am I missing? How to hold embedded app session through ruby on rails pages (same controller)

As expected no support here

Hello. Anyone here to help? :grin:

I’m struggling with this exact issue myself. :confused:

Hi,

You simply need to pass all the request parameters from Shopify to the route you want to navigate. This approach may not be the most elegant, but it’s a simple and effective solution I’ve found to work in this situation.