Applications vs. Services Have their own process Might have their own process Have their own database Probably share a database Scale independently Scales with the host app
Applications vs. Services Have their own process Might have their own process Have their own database Probably share a database Scale independently Scales with the host app Might be an another language Share the same language
1 # app/models/company.rb 2 class Company < ApplicationRecord 3 has_many :employees 4 end 5 6 # app/models/employee.rb 7 class Employee < ApplicationRecord 8 belongs_to :company 9 end Do we need this?
1 # app/services/create_company.rb 2 class CreateCompany 3 def self.call(company_params) 4 company = Company.create!(company_params) 5 6 CompanyMailer.welcome_email(company) 7 end 8 end