Skip to content

Instantly share code, notes, and snippets.

@ymendel
Created August 10, 2009 20:53
Show Gist options
  • Save ymendel/165406 to your computer and use it in GitHub Desktop.
Save ymendel/165406 to your computer and use it in GitHub Desktop.
<% @shop_order.attributes.each do |column| %>
<% next if column[0] == 'how_did_you_hear' %>
<input type=hidden name="shop_order[<%=h column[0] %>]" value="<%=h column[1] %>" />
<% end %>
<%# attr_accessors aren't in the attributes array %>
<% @shop_order.accessors.each do |a| %>
<input type=hidden name="shop_order[<%= a %>]" value="<%=h eval("@shop_order."+a) %>" />
<% end %>
class ShopOrder < ActiveRecord::Base
# list of accessors we need to keep in the track
def accessors
['creditcard_type','creditcard_number','creditcard_exp_month','creditcard_exp_year','creditcard_ccv']
end
# Fields we don't record in the database
attr_accessor :creditcard_type
attr_accessor :creditcard_number
attr_accessor :creditcard_exp_month
attr_accessor :creditcard_exp_year
attr_accessor :creditcard_ccv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment