Class: WorkerPlugins::ApplicationService
- Inherits:
-
ServicePattern::Service
- Object
- ServicePattern::Service
- WorkerPlugins::ApplicationService
show all
- Defined in:
- app/services/worker_plugins/application_service.rb
Instance Method Summary
collapse
Instance Method Details
#db_now_value ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
|
# File 'app/services/worker_plugins/application_service.rb', line 2
def db_now_value
@db_now_value ||= begin
time_string = Time.zone.now.strftime("%Y-%m-%d %H:%M:%S")
if postgres?
"CAST(#{quote(time_string)} AS TIMESTAMP)"
else
quote(time_string)
end
end
end
|
#postgres? ⇒ Boolean
26
27
28
|
# File 'app/services/worker_plugins/application_service.rb', line 26
def postgres?
ActiveRecord::Base.connection.instance_values["config"][:adapter].downcase.include?("postgres")
end
|
#quote(value) ⇒ Object
14
15
16
|
# File 'app/services/worker_plugins/application_service.rb', line 14
def quote(value)
WorkerPlugins::Workplace.connection.quote(value)
end
|
#quote_column(value) ⇒ Object
18
19
20
|
# File 'app/services/worker_plugins/application_service.rb', line 18
def quote_column(value)
WorkerPlugins::Workplace.connection.quote_column_name(value)
end
|
#quote_table(value) ⇒ Object
22
23
24
|
# File 'app/services/worker_plugins/application_service.rb', line 22
def quote_table(value)
WorkerPlugins::Workplace.connection.quote_table_name(value)
end
|
#sqlite? ⇒ Boolean
30
31
32
|
# File 'app/services/worker_plugins/application_service.rb', line 30
def sqlite?
ActiveRecord::Base.connection.instance_values["config"][:adapter].downcase.include?("sqlite")
end
|