Skip to content

Conversation

@s6577t
Copy link
Contributor

@s6577t s6577t commented Jul 24, 2014

As dicussed in #61

@s6577t s6577t changed the title include the view helper in a railtie Include the view helper in a railtie Jul 24, 2014
@zpao
Copy link
Member

zpao commented Aug 1, 2014

Tests pass, I assume you tested this yourself? @xionon, you're our actively participating rails expert, this is the right thing to do?

@xionon
Copy link
Contributor

xionon commented Aug 1, 2014

@sjltaylor @zpao I suggested this in #61, but apparently didn't dig deep enough. Based on this blog post, it should probably look like this:

initializer "react_rails.setup_view_helpers" do
  ActiveSupport.on_load(:action_view) do
    ActionView::Base.send :include ::React::Rails::ViewHelper
  end
end

Depending on the scope that Rails passes to the block, you might even be able to use

initializer "react_rails.setup_view_helpers" do
  ActiveSupport.on_load(:action_view) do
    include ::React::Rails::ViewHelper
  end
end
  1. sorry for not suggesting that in the first place, 2) I haven't actually tested this. I should have time this weekend to poke at it, if you don't.

@zpao
Copy link
Member

zpao commented Aug 1, 2014

👍 I'll let you guys work out the right thing.

@s6577t
Copy link
Contributor Author

s6577t commented Aug 4, 2014

@xionon The blocks context is ActionView::Base: #74

@s6577t s6577t closed this Aug 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants