Skip to content

Failed to invoke helpers with activejob #97

@Aaron2Ti

Description

@Aaron2Ti

From the readme, it says:

ActiveDecorator::ViewContext.run_with ApplicationController.new.view_context do
  ## perform some heavy jobs here
end

However, what I did is the following

↪ rails runner 'ActiveDecorator::ViewContext.run_with(ApplicationController.new.view_context) { puts User.last.name_with_company }'
undefined method `name_with_company' for #<User:0x000000000b63ee70>
Did you mean?  name_will_change!

but maually extend would work:

↪ rails runner 'u = User.last; u.extend UserDecorator; puts u.name_with_company'
Foo Bar

Am i missing sth?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions