move swag fields to partial
This commit is contained in:
parent
93f7e07ebe
commit
e55509183c
5 changed files with 21 additions and 23 deletions
|
|
@ -3,11 +3,20 @@ class Sponsor < ActiveRecord::Base
|
|||
belongs_to :conference
|
||||
|
||||
serialize :swag_hash, Hash
|
||||
attr_accessor :type, :quantity, :swag_index
|
||||
attr_accessor :type, :quantity, :swag_index, :hint_hash
|
||||
|
||||
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
|
||||
|
||||
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