Class: Ibrain::Base
Constant Summary
collapse
- IGNORE_ATTRIBUTES =
%w(id created_at updated_at)
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.adjust_date_for_cdt(datetime) ⇒ Object
51
52
53
|
# File 'app/models/ibrain/base.rb', line 51
def adjust_date_for_cdt(datetime)
datetime.in_time_zone('UTC')
end
|
.display_includes ⇒ Object
Provides a scope that should be included any time data are fetched with the intention of displaying to the user.
Allows individual stores to include any active record scopes or joins when data are displayed.
43
44
45
|
# File 'app/models/ibrain/base.rb', line 43
def display_includes
where(nil)
end
|
.paginate(args) ⇒ Object
47
48
49
|
# File 'app/models/ibrain/base.rb', line 47
def paginate(args)
limit(args[:limit]).offset(args[:offset])
end
|
.permitted_attributes ⇒ Object
55
56
57
|
# File 'app/models/ibrain/base.rb', line 55
def permitted_attributes
column_names.reject { |k| IGNORE_ATTRIBUTES.include?(k) }
end
|
Instance Method Details
#created_in_word ⇒ Object
33
34
35
|
# File 'app/models/ibrain/base.rb', line 33
def created_in_word
time_ago_in_words(created_at)
end
|
#cryptor ⇒ Object
29
30
31
|
# File 'app/models/ibrain/base.rb', line 29
def cryptor
::Ibrain::Encryptor.new
end
|
#string_id ⇒ Object
10
11
12
|
# File 'app/models/ibrain/base.rb', line 10
def string_id
try(:id).try(:to_s)
end
|