Sha256: ae18f4009de5448dcf759ec4978fb87c041da24c77cff2052defa631356770e8

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 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_input)
        title_to_delete = self.all[user_input-1].title
        self.where(title: title_to_delete).destroy_all
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
find_deals-0.1.0 lib/find_deals/saved_deals.rb