Swags stored correctly
This commit is contained in:
parent
2042d0eb7a
commit
4381f687b6
7 changed files with 18 additions and 28 deletions
|
|
@ -2,7 +2,7 @@ class Sponsor < ActiveRecord::Base
|
|||
belongs_to :sponsorship_level
|
||||
belongs_to :conference
|
||||
|
||||
serialize :swag_hash, Hash
|
||||
serialize :swags, Hash
|
||||
attr_accessor :type, :quantity, :swag_index, :hint_hash
|
||||
|
||||
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
||||
|
|
@ -10,13 +10,4 @@ class Sponsor < ActiveRecord::Base
|
|||
mount_uploader :picture, PictureUploader, mount_on: :logo_file_name
|
||||
|
||||
validates :name, :website_url, :sponsorship_level, presence: true
|
||||
|
||||
def generate_swags_hash(type, quantity)
|
||||
unless swag_hash
|
||||
swag_hash = {}
|
||||
end
|
||||
|
||||
swag_hash[type.to_s] = quantity.to_i
|
||||
update_attribute(:swag_hash, @sponsor.swag_hash)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue