Skip to content

Instantly share code, notes, and snippets.

@plukevdh
Created November 11, 2009 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plukevdh/232161 to your computer and use it in GitHub Desktop.
Save plukevdh/232161 to your computer and use it in GitHub Desktop.
Allows confirmation page parameter passing to only pass changed values and lets us pull the values back out to the customer attributes.
# grabs the changed hash and maps it to a flat hash containing just the updated params
@customer.attributes = Hash[*(params[:customer].map{|k,v| [k, v.last]}.flatten)]
# just pass the changed parameters to the controller. note, this page is form-less.
# simply passing parameters via 'get'. Not sure this is a good idea.
<%= link_to "Confirm Changes", {:action => "confirm", :customer => @customer.changes} %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment