Permalink
Browse files

Merge pull request #59 from moonmaster9000/patch-1

Update readme with interpolation options example
  • Loading branch information...
2 parents a3d0640 + 1eaf85d commit a9c5f7a62cb76388ce4c31192930a0a366bb855a @josevalim josevalim committed Jan 19, 2013
Showing with 23 additions and 0 deletions.
  1. +23 −0 README.md
View
23 README.md
@@ -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 a9c5f7a

Please sign in to comment.