Created
May 16, 2012 21:45
-
-
Save glideranderson/2714214 to your computer and use it in GitHub Desktop.
Horrible rails controller method, need help
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{: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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_payment_history | |
history = Array.new | |
@payments.each do |p| | |
response = Rails.application.config.payment_gateway.status_recurring(p.profile_id) | |
if response.success? | |
history << { | |
:active => (response.params['profile_status'] == 'ActiveProfile') ? 'yes' : 'no', | |
:start => p.created_at, #response.params['billing_start_date'], | |
:amount => response.params['amount'], | |
:card_type => response.params['credit_card_type'], | |
:card_number => response.params['credit_card_number'] | |
} | |
end | |
end | |
return history | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= @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