Skip to content

Commit

Permalink
fixed the virtual columns to be able to use in api with filter[]
Browse files Browse the repository at this point in the history
  • Loading branch information
AparnaKarve committed Jun 7, 2018
1 parent b54878c commit fa60b22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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
3 changes: 2 additions & 1 deletion app/models/service_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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 :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 fa60b22

Please sign in to comment.