Rails读写分离实现
报表组件读写分离实现#These methods are created for db slice:ReadOnly.
def self.update_report report
ReportUpdate.find(report.id).update_attributes(report.attributes)
end
def self.create_report new_report ReportUpdate.create(new_report.attributes) end
end
?
?
数据库配置文件代码:
jobs:
adapter: mysql
host: *
username: *
password: *
database: *
encoding: utf8
master_db:
adapter: mysql
host: *
username: *
password: *
database: *
encoding: utf8
mysql: &using
adapter: mysql
host: *
username: *
password: *
database: *
encoding: utf8
development:
<<: *using
production:
<<: *using
test:
<<: *localhost