chrismccord/sync — pull request #22 by shimms (2013-05-02 10:38:51+00:00)
Title: Added ability to pass options for rendering partials to sync methods

I'm not sure if this is the best approach to my issue, but thought I'd put it up for a starting point.

We have a controller action in our app which responds to the :voice format (is a Twillio callback handler). From this controller action we invoke a `sync_update` on our model. The controller action responds to the `:voice` format, but the partial that needs to be rendered from the `sync_update` isn't in the `:voice` format.

When the update is invoked attempting to render the partial results in an error as it is unable to find a partial matching that format (the partial is `_item_row.html.haml`).

I added a third paramater to sync_update and sync_destroy which allows you to pass options for the partial rendering. The options can be passed as:

sync_update @model, {}, {:formats => [:html]}

The supplied `partial_options` (defaults to `{}`) propagate to the eventual `render` method and is merged into the render options along side `locals` and `path`.

I've been using the patch and it renders partials now from controller actions responding to different formats correctly and doesn't change default behaviour.