patbenatar / rbexy

A Ruby template language and component framework inspired by JSX and React
MIT License
39 stars 5 forks source link

create_context inside a Rails controller #50

Closed patbenatar closed 3 years ago

patbenatar commented 3 years ago

It would be great to be able to add data to the root context with create_context from the controller:

class MyController
  def index
    create_context(:thing, "foo")
  end
end

to later be accessed by components within the render hierarchy of this controller action.

Unfortunately, in Rails, view_context is a different object (unique Object ID) in the controller than it is in the view.