Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BoughtDetail < ActiveRecord::Base
- belongs_to :entry_type
- belongs_to :person
- before_save :set_bought_data, :set_end_on, :set_start_on
- attr_accessor :credit_card, :card_code, :days
- def set_bought_data
- self.bought_data = Date.today
- end
- def set_start_on
- self.start_on = bought_data if start_on.nil?
- end
- def set_end_on
- days = "7" if days.nil?
- self.end_on = Date.today + days.to_i
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment