Skip to content

Commit

Permalink
Merge pull request #17553 from AparnaKarve/fix_archived_api_attribute
Browse files Browse the repository at this point in the history
Fixed the virtual columns to be able to use in the API with `filter[]`
(cherry picked from commit 58af1d2)

https://bugzilla.redhat.com/show_bug.cgi?id=1594023
  • Loading branch information
agrare authored and simaishi committed Jun 21, 2018
1 parent 23e26a2 commit 518a0ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/mixins/archived_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ module ArchivedMixin
def archived?
!active?
end
alias_method :archived, :archived?

def active?
deleted_on.nil?
end
alias_method :active, :active?

def archive!
update_attributes!(:deleted_on => Time.now.utc)
Expand Down
2 changes: 2 additions & 0 deletions app/models/service_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class ServiceTemplate < ApplicationRecord
virtual_column :type_display, :type => :string
virtual_column :template_valid, :type => :boolean
virtual_column :template_valid_error_message, :type => :string
virtual_column :archived, :type => :boolean
virtual_column :active, :type => :boolean

default_value_for :service_type, 'unknown'
default_value_for(:generic_subtype) { |st| 'custom' if st.prov_type == 'generic' }
Expand Down

0 comments on commit 518a0ae

Please sign in to comment.