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

DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated #43

Closed
A5308Y opened this issue Feb 2, 2021 · 5 comments
Closed

Comments

@A5308Y
Copy link

A5308Y commented Feb 2, 2021

Hello there and thanks for prawn-rails!

We're seeing a deprecation warning since a recent rails upgrade:

DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: .../show.pdf.prawn

We're rendering a file the way suggested in https://github.com/cortiz/prawn-rails/issues/32, but I assume this is an issue with all templates that follow the file naming convention from your docs.

Is this something you're aware of? Are you working on a fix or do you have a suggestion on how to fix the issue on our side?

Thanks in advance and all the best!

@westonganger
Copy link
Collaborator

Can you show me the call to the render action from your controller code?

@A5308Y
Copy link
Author

A5308Y commented Feb 3, 2021

Hi @westonganger, thanks for the quick reply. It looks like this:

Admin::ContractsController.render(
  template: "admin/contracts/show.pdf.prawn",
  assigns: {
    decorated_pdf_contract: DecoratedPdfContract.new(@contract)
  }
)

@westonganger
Copy link
Collaborator

So you are trying to render to a string? We discussed this in #32

Maybe try one of the following (untested):

render_to_string(
  "admin/contracts/show", 
  formats: [:pdf],
  assigns: {
    decorated_pdf_contract: DecoratedPdfContract.new(@contract)
  }
)

### OR

Admin::ContractsController.render(
  template: "admin/contracts/show",
  formats: [:pdf],
  assigns: {
    decorated_pdf_contract: DecoratedPdfContract.new(@contract)
  }
)

@A5308Y
Copy link
Author

A5308Y commented Feb 3, 2021

Oh man. This is embarrassing. I tried format (without the "s") and gave up when it didn't work...

template: "admin/contracts/show",
formats: [:pdf],

Works perfectly.

Thanks again for the quick responses @westonganger!

@A5308Y A5308Y closed this as completed Feb 3, 2021
@westonganger
Copy link
Collaborator

:D

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