Skip to content

Instantly share code, notes, and snippets.

@igkuz
Created March 9, 2019 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igkuz/982c29a41aef4bf6e1bd4cafa986a622 to your computer and use it in GitHub Desktop.
Save igkuz/982c29a41aef4bf6e1bd4cafa986a622 to your computer and use it in GitHub Desktop.
ROM Commands for Post and Company
class CreateCompany < ROM::Commands::Create[:sql]
relation :companies
register_as :create
result :one
use :timestamps
timestamp :created_at, :updated_at
end
class CreatePost < ROM::Commands::Create[:sql]
relation :posts
register_as :create
result :one
use :timestamps
timestamp :scrapped_at, :created_at, :updated_at
end
class DeleteCompany < ROM::Commands::Delete[:sql]
relation :companies
register_as :delete
end
class DeletePost < ROM::Commands::Delete[:sql]
relation :posts
register_as :delete
end
class UpdatePost < ROM::Commands::Update[:sql]
relation :posts
register_as :update
use :timestamps
timestamp :updated_at
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment