Class: Naf::ApplicationScheduleAffinityTab
- Defined in:
- app/models/naf/application_schedule_affinity_tab.rb
Class Method Summary collapse
Instance Method Summary collapse
- #application ⇒ Object
- #pickle(pickler, associations = nil, ignored_attributes = [:created_at, :updated_at]) ⇒ Object
-
#script_title ⇒ Object
————————- *** Instance Methods *** +++++++++++++++++++++++++.
Methods inherited from NafBase
Class Method Details
.pickleables(pickler) ⇒ Object
51 52 53 54 |
# File 'app/models/naf/application_schedule_affinity_tab.rb', line 51 def self.pickleables(pickler) self.joins([application_schedule: :application]). where('applications.deleted = false') end |
Instance Method Details
#application ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/models/naf/application_schedule_affinity_tab.rb', line 43 def application if schedule = application_schedule application_schedule.application else nil end end |
#pickle(pickler, associations = nil, ignored_attributes = [:created_at, :updated_at]) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/models/naf/application_schedule_affinity_tab.rb', line 56 def pickle(pickler, associations = nil, ignored_attributes = [:created_at, :updated_at]) instance_attributes = attributes.symbolize_keys ignored_attributes.each do |ignored_attribute| instance_attributes.delete(ignored_attribute.to_sym) end unless associations associations = {} instance_attributes.keys.select{|key| key.to_s =~ /_id$/}.each do |key| association_name = key.to_s[0..-4].to_sym association = association(association_name) rescue nil if association associations[key] = association.[:class_name].constantize.name end end end return Hash[instance_attributes.map { |key, value| if associations[key] == 'Naf::Affinity' [key, { association_model_name: associations[key], association_classification_value: affinity.affinity_classification_id, association_affinity_value: affinity.affinity_name }] elsif associations[key] == 'Naf::ApplicationSchedule' [key, { association_model_name: associations[key], association_value: value }] else [key,value] end } ] end |
#script_title ⇒ Object
*** Instance Methods *** +++++++++++++++++++++++++
39 40 41 |
# File 'app/models/naf/application_schedule_affinity_tab.rb', line 39 def script_title application_schedule.title end |