Permalink
Browse files

Update readme with interpolation options example

Seems like a pretty important thing to mention to make this library more useful.
  • Loading branch information...
1 parent a3d0640 commit 1eaf85dc11c322d8ab150da8a9482cec2b18a4ca @moonmaster9000 moonmaster9000 committed Jan 19, 2013
Showing with 23 additions and 0 deletions.
  1. +23 −0 README.md
View
@@ -120,6 +120,29 @@ class InvitationsController < ApplicationController
end
```
+## Interpolation Options
+
+You can pass in extra interpolation options for the translation by adding an `interpolation_options` method to your controller:
+
+```ruby
+class InvitationsController < ApplicationController
+ responders :flash, :http_cache
+
+ def create
+ @invitation = Invitation.create(params[:invitation])
+ respond_with @invitation
+ end
+
+ private
+
+ def interpolation_options
+ { resource_name: @invitation.email }
+ end
+end
+```
+
+Now you would see the message "bob@bob.com was successfully created" instead of the default "Invitation was successfully created."
+
## Generator
This gem also includes a responders controller generator, so your scaffold can be customized

0 comments on commit 1eaf85d

Please sign in to comment.