inertiajs / inertia-rails

The Rails adapter for Inertia.js.
https://inertiajs.com
MIT License
529 stars 43 forks source link

Rails Engine #43

Closed azal-io closed 3 years ago

azal-io commented 4 years ago

Inertia doesn't work in Rails Engine. It selects Main App's Application layout. Added initializer to engine but it is not getting picked up, and Inertia selects App's layout.

Could you please confirm whether this works in a Rails engine?

Thanks

azarcore commented 4 years ago

I tried a different approach on this one. Added a before action to set the layout for Engine's template.

I guess if we do with initializer then let's say that we have another engine with inertia and the app will get confuse about which 2 initializers to choose from. I guess by having it under Engine's App Ctrl we make sure that each engine selects its own template. On concern though, applying the same layout config over and over again. I guess caching won't work as well since we need to change the layout for the other Engine. Does anyone has any suggestion on this?

Thanks

BrandonShar commented 3 years ago

Hey @azal-io I'm not really sure of what you're trying to do here. You're trying to write a rails engine based around inertia and its not working as expected?

This isn't something we've tried internally, so I'm not sure where to start. Do you have an example we could look at?