Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render_widget helper collision #132

Open
pierpaolofrasa-twt opened this issue Oct 17, 2013 · 1 comment
Open

render_widget helper collision #132

pierpaolofrasa-twt opened this issue Oct 17, 2013 · 1 comment

Comments

@pierpaolofrasa-twt
Copy link

In our project we are exploring using apotomo alongside another library. Unfortunately, both expose a helper method with the same name, "render_widget". As soon as I add the has_widgets declaration into any controller, the render_widget helper of the other library gets overridden by apotomo's definition, which breaks everything.

It is of course a general problem with Rails helpers that they all end up polluting the same namespace, and somewhat ironically Nick blogged about this two years ago. :)

I wonder if there is any sort of workaround, or if it could be envisioned to rename the helper into something at least somewhat more namespaced ("widget" is a quite generic term).

I realise that this is kind of a bold feature request, but I think that in the spirit of that original blog post such an issue ought to be addressed at least in some way.

@apotonick
Copy link
Owner

That sucks indeed. I hate helpers.

In future versions of Cells (and Apotomo) you will have a more object-oriented access to the API, e.g. in views you will have an instance of your widget.

apotomo_widget(:song).show

I can have a quick look at how/when we import the helpers into the global namespace, I have an idea for an easy work-around.

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

No branches or pull requests

2 participants