Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update readme with interpolation options example

Seems like a pretty important thing to mention to make this library more useful.
  • Loading branch information...
commit 1eaf85dc11c322d8ab150da8a9482cec2b18a4ca 1 parent a3d0640
Matt Parker authored

Showing 1 changed file with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. 23  README.md
23  README.md
Source Rendered
@@ -120,6 +120,29 @@ class InvitationsController < ApplicationController
120 120
 end
121 121
 ```
122 122
 
  123
+## Interpolation Options
  124
+
  125
+You can pass in extra interpolation options for the translation by adding an `interpolation_options` method to your controller:
  126
+
  127
+```ruby
  128
+class InvitationsController < ApplicationController
  129
+  responders :flash, :http_cache
  130
+  
  131
+  def create
  132
+    @invitation = Invitation.create(params[:invitation])
  133
+    respond_with @invitation
  134
+  end  
  135
+  
  136
+  private
  137
+  
  138
+  def interpolation_options
  139
+    { resource_name: @invitation.email }
  140
+  end
  141
+end
  142
+```
  143
+
  144
+Now you would see the message "bob@bob.com was successfully created" instead of the default "Invitation was successfully created."
  145
+
123 146
 ## Generator
124 147
 
125 148
 This gem also includes a responders controller generator, so your scaffold can be customized

0 notes on commit 1eaf85d

Please sign in to comment.
Something went wrong with that request. Please try again.