urvin-compliance / caracal-rails

Caracal-Rails is a drop in solution for registering the Microsoft Word mime type and for establishing a template handler in Rails for the :docx format. It also provides a helper method for accessing the document object which currently has context.
MIT License
37 stars 11 forks source link

Interpolation for docx.p do block #9

Closed dwood-somniainc closed 5 years ago

dwood-somniainc commented 5 years ago

I am attempting to string together an object attribute and a sentence within the do block using text. For some odd reason, it says that the class is nil when I use instance variables inline

docx.p do
   text 'hello' @user.name  
end

How would you approach this issue?

jdugan commented 5 years ago

There's a section on lexical scoping near the bottom of the README. I'd encourage you to read that and the comments on the closed issue it references. That covers the topic, which is admittedly a little tricky in Caracal's case, pretty exhaustively.

If you do that and you're still confused, ping me again out here, and I'll provide a direct answer to your exact question.

jdugan commented 5 years ago

Sorry. I meant near the bottom of the README for Caracal itself. Here

dwood-somniainc commented 5 years ago

Perfect! Thanks