-
-
Save andyh/2918451 to your computer and use it in GitHub Desktop.
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
class CreditCard < ActiveRecord::Base | |
attr_accessible :bank, :benefit_earn_rate, :benefit_type, :benefit_value, :interest, :name, :brand, | |
:goal_name, :goal_cost, :goal_value | |
def goal | |
self.goal_cost.to_f / self.goal_value.to_f | |
end | |
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
<% @credit_cards.each do |credit_card| %> | |
<tr> | |
<td><%= credit_card.name %></td> | |
<td><%= credit_card.bank %></td> | |
<td><%= credit_card.brand %></td> | |
<td><%= credit_card.interest %></td> | |
<td><%= credit_card.benefit_type %></td> | |
<td><%= credit_card.benefit_earn_rate %></td> | |
<td><%= credit_card.goal %></td> | |
<td><%= credit_card.goal_name %></td> | |
<td><%= credit_card.goal_cost %></td> | |
<td><%= credit_card.goal_value %></td> | |
<td><%= link_to 'Show', credit_card %></td> | |
<td><%= link_to 'Edit', edit_credit_card_path(credit_card) %></td> | |
<td><%= link_to 'Destroy', credit_card, confirm: 'Are you sure?', method: :delete %></td> | |
</tr> | |
<% end %> | |
</table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment