Sha256: 8ad6d691b9ec591da3809a556466d5d9f448f3bc3f2a13dec367504279e16c5b
Contents?: true
Size: 852 Bytes
Versions: 2
Compression:
Stored size: 852 Bytes
Contents
class SavedDeals < ActiveRecord::Base belongs_to :users belongs_to :categories belongs_to :cities def print puts "====================================================================" puts "#{self.title.upcase}" puts "#{self.location}" puts "" puts "#{self.about}" puts "" puts "$#{self.price.to_i} - UP TO #{self.promotion.to_i}% OFF" puts "" puts "BUY NOW AT #{self.url}" puts "====================================================================" end def self.delete_from_db(user, user_input) selected_user_deals = SavedDeals.select {|deal| deal.user_id == user.id} title_to_delete = selected_user_deals[user_input-1].title SavedDeals.where(title: title_to_delete).destroy_all end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
find_deals-0.1.2 | lib/find_deals/saved_deals.rb |
find_deals-0.1.1 | lib/find_deals/saved_deals.rb |