mbleigh/princely — Issue #12: Cannot modify SafeBuffer in place
Author: asindhu
Created: 2011-10-18 20:17:57+00:00
State: open

I'm trying to use Princely with a Rails 3.0.9 app. I used the instructions at https://github.com/tehpeh/princely/commit/4003fd027fdad9fc77c8ed0e6cc6524681296c13 to install Princely.

Right now I'm just trying to test it out. I have a route that looks like

```
match '/test' => 'welcome#test'
```

and my controller method looks like this:

```
class WelcomeController < ApplicationController

...

def test
make_and_send_pdf("test")
end
```

And I have a file called "test.pdf.erb" in the view directory for this controller which just says 'hello world'. I'm not sure if this is the right way to set it up because I couldn't find any documentation on it but it seems to make sense.

Anyway, when I load the URL for this method, ".../test.pdf" I get the following error:

```
TypeError in WelcomeController#test
Cannot modify SafeBuffer in place
```

and the trace looks like this:

```
activesupport (3.0.9) lib/active_support/core_ext/string/output_safety.rb:127:in `gsub!'
princely (1.2.5) lib/princely/pdf_helper.rb:33:in `make_pdf'
princely (1.2.5) lib/princely/pdf_helper.rb:49:in `make_and_send_pdf'
app/controllers/welcome_controller.rb:8:in `test'
...
```

where that last line, 'welcome_controller.rb:8' is the 'make_and_send_pdf' statement above in my controller code. Does anyone know why this might be happening? I would appreciate the help. Thanks!