2

Some Rails application generates a view with some information displayed about a resource.

I'd like to suppress some of the information through a plugin, without altering nor overriding the view. (A possible way is to rewrite the view in the plugin but this may interfere with other plugins, and I don't want that.)

Is there a way to modify the controller instead, so that the generated view is post-processed before being sent to the client?

Can this be achieved with after_filter ? I try to find an example of after_filter usage, but the documentation seems low and I can't find a good example.

glmxndr
  • 45,516
  • 29
  • 93
  • 118

1 Answers1

2

You can use render_to_string instead of render to first render the view to a string.

Veeti
  • 5,270
  • 3
  • 31
  • 37