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

Can't use font-awesome helper when running through after_party #831

Open
davetapley opened this issue May 31, 2018 · 1 comment
Open

Can't use font-awesome helper when running through after_party #831

davetapley opened this issue May 31, 2018 · 1 comment

Comments

@davetapley
Copy link

davetapley commented May 31, 2018

I have a decorator which looks like:

class FooDecorator < Draper::Decorator
  def bar
    h.fa_icon 'tag'
  end

It works just fine when called either:

  • As part of a web request, through rails server
  • By a rake task

However when I call the same code in an after_party task I get:

NoMethodError: undefined method `fa_icon' for #<#<Class:0x0000000006ad52e0>:0x00000000069a60b8>
/usr/local/bundle/gems/draper-2.1.0/lib/draper/helper_proxy.rb:35:in `block in define_proxy'

I was able to work around the issue (taking inspiration from here) by creating a config/initializers/draper.rb with:

Draper::HelperProxy.extend ApplicationHelper

I presume that is something which normally happens automagically, but is somehow being skipped when I'm running through after_party?


Versions:

draper (2.1.0)
rails (4.2.8)
font-awesome-rails (4.7.0.0)
after_party (1.8)
@davetapley
Copy link
Author

⬆️ my workaround doesn't seem to work, it just intermittently didn't fail, which is even more confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants