Skip to content

Instantly share code, notes, and snippets.

@machuga
Forked from glideranderson/payments.html
Created May 16, 2012 23:46
Show Gist options
  • Save machuga/2714960 to your computer and use it in GitHub Desktop.
Save machuga/2714960 to your computer and use it in GitHub Desktop.
Horrible rails controller method, need help
[{:active=>"no", :start=>Tue, 15 May 2012 20:42:17 UTC +00:00, :amount=>"10.00", :card_type=>"Visa", :card_number=>"0195"}]
<p>Get this output at the end of my .each</p>
def get_payment_history
history = []
@payments.each do |p|
response = Rails.application.config.payment_gateway.status_recurring(p.profile_id)
history << response.params.merge({ start: p.created_at }) if response.success?
end
history
end
= @history.each do |h|
.row
.three.columns
= h[:active]
.three.columns
= h[:start].strftime("%b %d, %Y")
.two.columns
= h[:amount]
.two.columns
= h[:card_type]
.two.columns
= h[:card_number]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment